forked from M-Labs/artiq
runtime: cleanup now_init/now_save
This commit is contained in:
parent
4e241f10c5
commit
2ae20fbc4d
|
@ -335,6 +335,38 @@ void exception_handler(unsigned long vect, unsigned long *regs,
|
|||
vect, pc, ea);
|
||||
}
|
||||
|
||||
static void now_init(void)
|
||||
{
|
||||
struct msg_base request;
|
||||
struct msg_now_init_reply *reply;
|
||||
|
||||
request.type = MESSAGE_TYPE_NOW_INIT_REQUEST;
|
||||
mailbox_send_and_wait(&request);
|
||||
|
||||
reply = mailbox_wait_and_receive();
|
||||
if(reply->type != MESSAGE_TYPE_NOW_INIT_REPLY) {
|
||||
core_log("Malformed MESSAGE_TYPE_NOW_INIT_REQUEST reply type %d\n",
|
||||
reply->type);
|
||||
while(1);
|
||||
}
|
||||
now = reply->now;
|
||||
mailbox_acknowledge();
|
||||
|
||||
if(now < 0) {
|
||||
rtio_init();
|
||||
now = rtio_get_counter() + (272000 << CONFIG_RTIO_FINE_TS_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
static void now_save(void)
|
||||
{
|
||||
struct msg_now_save request;
|
||||
|
||||
request.type = MESSAGE_TYPE_NOW_SAVE;
|
||||
request.now = now;
|
||||
mailbox_send_and_wait(&request);
|
||||
}
|
||||
|
||||
int main(void);
|
||||
int main(void)
|
||||
{
|
||||
|
@ -368,9 +400,9 @@ int main(void)
|
|||
|
||||
mailbox_send_and_wait(&load_reply);
|
||||
|
||||
now = now_init();
|
||||
now_init();
|
||||
kernel_run();
|
||||
now_save(now);
|
||||
now_save();
|
||||
|
||||
attribute_writeback(typeinfo);
|
||||
|
||||
|
@ -387,7 +419,8 @@ int main(void)
|
|||
/* called from __artiq_personality */
|
||||
void __artiq_terminate(struct artiq_exception *artiq_exn,
|
||||
struct artiq_backtrace_item *backtrace,
|
||||
size_t backtrace_size) {
|
||||
size_t backtrace_size)
|
||||
{
|
||||
struct msg_exception msg;
|
||||
|
||||
msg.type = MESSAGE_TYPE_EXCEPTION;
|
||||
|
@ -399,46 +432,12 @@ void __artiq_terminate(struct artiq_exception *artiq_exn,
|
|||
while(1);
|
||||
}
|
||||
|
||||
void ksupport_abort() {
|
||||
void ksupport_abort()
|
||||
{
|
||||
artiq_raise_from_c("InternalError", "abort() called; check device log for details",
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
long long int now_init(void)
|
||||
{
|
||||
struct msg_base request;
|
||||
struct msg_now_init_reply *reply;
|
||||
long long int now;
|
||||
|
||||
request.type = MESSAGE_TYPE_NOW_INIT_REQUEST;
|
||||
mailbox_send_and_wait(&request);
|
||||
|
||||
reply = mailbox_wait_and_receive();
|
||||
if(reply->type != MESSAGE_TYPE_NOW_INIT_REPLY) {
|
||||
core_log("Malformed MESSAGE_TYPE_NOW_INIT_REQUEST reply type %d\n",
|
||||
reply->type);
|
||||
while(1);
|
||||
}
|
||||
now = reply->now;
|
||||
mailbox_acknowledge();
|
||||
|
||||
if(now < 0) {
|
||||
rtio_init();
|
||||
now = rtio_get_counter() + (272000 << CONFIG_RTIO_FINE_TS_WIDTH);
|
||||
}
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
void now_save(long long int now)
|
||||
{
|
||||
struct msg_now_save request;
|
||||
|
||||
request.type = MESSAGE_TYPE_NOW_SAVE;
|
||||
request.now = now;
|
||||
mailbox_send_and_wait(&request);
|
||||
}
|
||||
|
||||
int watchdog_set(int ms)
|
||||
{
|
||||
struct msg_watchdog_set_request request;
|
||||
|
|
|
@ -6,8 +6,6 @@ struct artiq_list {
|
|||
int32_t *elements;
|
||||
};
|
||||
|
||||
long long int now_init(void);
|
||||
void now_save(long long int now);
|
||||
int watchdog_set(int ms);
|
||||
void watchdog_clear(int id);
|
||||
void send_rpc(int service, const char *tag, ...);
|
||||
|
|
Loading…
Reference in New Issue