#include #include #include #include #include "encoding.h" #include "platform.h" #include "eos.h" #include "msgq.h" #include "event.h" EOSMsgQ _eos_event_q; static EOSMsgItem event_q_array[EOS_EVT_SIZE_Q]; static eos_evt_handler_t evt_handler[EOS_EVT_MAX_EVT + 1]; __attribute__ ((section (".itim"))) static void evtq_handler(unsigned char type, unsigned char *buffer, uint16_t len) { unsigned char idx = (type & EOS_EVT_MASK) >> 4; if (idx && (idx <= EOS_EVT_MAX_EVT)) { evt_handler[idx](type, buffer, len); } else { eos_evtq_bad_handler(type, buffer, len); } } int eos_evtq_init(uint8_t wakeup_cause) { int i; evt_handler[0] = evtq_handler; for (i=0; i> 4; if (handler == NULL) handler = eos_evtq_bad_handler; if (idx <= EOS_EVT_MAX_EVT) evt_handler[idx] = handler; } __attribute__ ((section (".itim"))) eos_evt_handler_t eos_evtq_get_handler(unsigned char type) { unsigned char idx = (type & EOS_EVT_MASK) >> 4; if (idx <= EOS_EVT_MAX_EVT) return evt_handler[idx]; return NULL; }