This commit is contained in:
2020-06-29 20:01:55 +02:00
parent 75e9d63341
commit 285ef30439
10 changed files with 154 additions and 65 deletions

View File

@ -2360,6 +2360,10 @@ void *start_timer(void *arg) {
int stopStateMachine() {
LOG(logINFORED, ("Stopping State Machine\n"));
// if scan active, stop scan
if (sharedMemory_getScanStatus()) {
sharedMemory_setScanStop(1);
}
#ifdef VIRTUAL
if (!isControlServer) {
virtual_stop = 1;
@ -2380,26 +2384,25 @@ int stopStateMachine() {
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
usleep(WAIT_TIME_US_STP_ACQ);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STP_ACQSTN_MSK);
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
return OK;
}
enum runStatus getRunStatus() {
LOG(logDEBUG1, ("Getting status\n"));
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = sharedMemory_getStatus();
}
if (virtual_status == 0) {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
} else {
if (sharedMemory_getScanStatus() || sharedMemory_getStatus()) {
LOG(logINFOBLUE, ("Status: RUNNING\n"));
return RUNNING;
}
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
LOG(logDEBUG1, ("Getting status\n"));
if (sharedMemory_getScanStatus()) {
LOG(logINFOBLUE, ("Status: Scan RUNNING\n"));
return RUNNING;
}
uint32_t retval = bus_r(STATUS_REG);
LOG(logINFO, ("Status Register: %08x\n", retval));