-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
Fixes #316.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,9 @@ class _D2HMsgType(Enum): | |
FLASH_OK_REPLY = 12 | ||
FLASH_ERROR_REPLY = 13 | ||
|
||
WATCHDOG_EXPIRED = 14 | ||
CLOCK_FAILURE = 15 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
whitequark
Author
Contributor
|
||
|
||
|
||
class UnsupportedDevice(Exception): | ||
pass | ||
|
@@ -522,6 +525,10 @@ def serve(self, object_map, symbolizer): | |
self._serve_rpc(object_map) | ||
elif self._read_type == _D2HMsgType.KERNEL_EXCEPTION: | ||
self._serve_exception(object_map, symbolizer) | ||
elif self._read_type == _D2HMsgType.WATCHDOG_EXPIRED: | ||
raise exceptions.WatchdogExpired | ||
elif self._read_type == _D2HMsgType.CLOCK_FAILURE: | ||
raise exceptions.ClockFailure | ||
else: | ||
self._read_expect(_D2HMsgType.KERNEL_FINISHED) | ||
return |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,3 +129,9 @@ class DDSBatchError(Exception): | |
class I2CError(Exception): | ||
"""Raised with a I2C transaction fails.""" | ||
artiq_builtin = True | ||
|
||
class WatchdogExpired(Exception): | ||
"""Raised when a watchdog expires.""" | ||
|
||
class ClockFailure(Exception): | ||
"""Raised when RTIO PLL is unable to lock.""" | ||
This comment has been minimized.
Sorry, something went wrong.
sbourdeauducq
Member
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,7 +392,10 @@ enum { | |
|
||
REMOTEMSG_TYPE_FLASH_READ_REPLY, | ||
REMOTEMSG_TYPE_FLASH_OK_REPLY, | ||
REMOTEMSG_TYPE_FLASH_ERROR_REPLY | ||
REMOTEMSG_TYPE_FLASH_ERROR_REPLY, | ||
|
||
REMOTEMSG_TYPE_WATCHDOG_EXPIRED, | ||
REMOTEMSG_TYPE_CLOCK_FAILURE, | ||
}; | ||
|
||
static int receive_rpc_value(const char **tag, void **slot); | ||
|
@@ -1083,30 +1086,36 @@ int session_input(void *data, int length) | |
/* *length is set to -1 in case of irrecoverable error | ||
* (the session must be dropped and session_end called) | ||
*/ | ||
void session_poll(void **data, int *length) | ||
void session_poll(void **data, int *length, int *close_flag) | ||
{ | ||
*close_flag = 0; | ||
|
||
if(user_kernel_state == USER_KERNEL_RUNNING) { | ||
if(watchdog_expired()) { | ||
core_log("Watchdog expired\n"); | ||
*length = -1; | ||
return; | ||
|
||
*close_flag = 1; | ||
out_packet_empty(REMOTEMSG_TYPE_WATCHDOG_EXPIRED); | ||
} | ||
if(!rtiocrg_check()) { | ||
core_log("RTIO clock failure\n"); | ||
*length = -1; | ||
return; | ||
|
||
*close_flag = 1; | ||
out_packet_empty(REMOTEMSG_TYPE_CLOCK_FAILURE); | ||
This comment has been minimized.
Sorry, something went wrong.
jordens
Member
|
||
} | ||
} | ||
|
||
/* If the output buffer is available, | ||
* check if the kernel CPU has something to transmit. | ||
*/ | ||
if(out_packet_available()) { | ||
struct msg_base *umsg = mailbox_receive(); | ||
if(umsg) { | ||
if(!process_kmsg(umsg)) { | ||
*length = -1; | ||
return; | ||
if(!*close_flag) { | ||
/* If the output buffer is available, | ||
* check if the kernel CPU has something to transmit. | ||
*/ | ||
if(out_packet_available()) { | ||
struct msg_base *umsg = mailbox_receive(); | ||
if(umsg) { | ||
if(!process_kmsg(umsg)) { | ||
*length = -1; | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
|
This is redundant with CLOCK_SWITCH_FAILED.