URL
https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 2 |
Rev 3 |
Line 80... |
Line 80... |
logFile_.to_string());
|
logFile_.to_string());
|
logfile_ = fopen(logFile_.to_string(), "w");
|
logfile_ = fopen(logFile_.to_string(), "w");
|
}
|
}
|
}
|
}
|
|
|
|
//#define READ_RAWDATA_FROM_FILE
|
void ComPortService::busyLoop() {
|
void ComPortService::busyLoop() {
|
char tbuf[4096];
|
char tbuf[4096];
|
int tbuf_cnt;
|
int tbuf_cnt;
|
|
#ifdef READ_RAWDATA_FROM_FILE
|
|
FILE *script = fopen("e:/uart0.log", "r");
|
|
char logbuf[1024];
|
|
int logbuf_sz;
|
|
#endif
|
|
|
while (isEnabled()) {
|
while (isEnabled()) {
|
if (!isSimulation_ && !portOpened_) {
|
if (!isSimulation_ && !portOpened_) {
|
int err = openSerialPort(comPortName_.to_string(),
|
int err = openSerialPort(comPortName_.to_string(),
|
comPortSpeed_.to_int(), &hPort_);
|
comPortSpeed_.to_int(), &hPort_);
|
if (err < 0) {
|
if (err < 0) {
|
RISCV_error("Openning %s at %d . . .failed",
|
RISCV_error("Openning %s at %d . . .failed",
|
comPortName_.to_string(), comPortSpeed_.to_int());
|
comPortName_.to_string(), comPortSpeed_.to_int());
|
RISCV_sleep_ms(1000);
|
RISCV_sleep_ms(1000);
|
|
#ifdef READ_RAWDATA_FROM_FILE
|
|
logbuf_sz = fread(logbuf, 1, sizeof(logbuf), script);
|
|
if (logbuf_sz) {
|
|
for (unsigned i = 0; i < portListeners_.size(); i++) {
|
|
IRawListener *ilstn = static_cast<IRawListener *>(
|
|
portListeners_[i].to_iface());
|
|
ilstn->updateData(logbuf, logbuf_sz);
|
|
}
|
|
}
|
|
#endif
|
continue;
|
continue;
|
} else {
|
} else {
|
portOpened_ = true;
|
portOpened_ = true;
|
}
|
}
|
}
|
}
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.