summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/cell.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/cell.c')
-rw-r--r--fw/fe310/eos/cell.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fw/fe310/eos/cell.c b/fw/fe310/eos/cell.c
index 452fb47..2886041 100644
--- a/fw/fe310/eos/cell.c
+++ b/fw/fe310/eos/cell.c
@@ -10,7 +10,7 @@
static eos_evt_handler_t evt_handler[EOS_CELL_MAX_MTYPE];
-static void cell_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
+static void cell_handle_msg(unsigned char type, unsigned char *buffer, uint16_t len) {
unsigned char mtype;
unsigned char idx;
@@ -28,19 +28,13 @@ static void cell_handle_evt(unsigned char type, unsigned char *buffer, uint16_t
}
}
-static void cell_handle_rdy(unsigned char type, unsigned char *buffer, uint16_t len) {
- // Do nothing
- eos_net_free(buffer, 0);
-}
-
void eos_cell_init(void) {
int i;
for (i=0; i<EOS_CELL_MAX_MTYPE; i++) {
evt_handler[i] = NULL;
}
- eos_net_set_handler(EOS_NET_MTYPE_CELL, cell_handle_evt);
- eos_cell_set_handler(EOS_CELL_MTYPE_READY, cell_handle_rdy);
+ eos_net_set_handler(EOS_NET_MTYPE_CELL, cell_handle_msg);
}
void eos_cell_set_handler(unsigned char mtype, eos_evt_handler_t handler) {
@@ -48,3 +42,10 @@ void eos_cell_set_handler(unsigned char mtype, eos_evt_handler_t handler) {
if (idx < EOS_CELL_MAX_MTYPE) evt_handler[idx] = handler;
}
+
+eos_evt_handler_t eos_cell_get_handler(unsigned char mtype) {
+ unsigned char idx = (mtype & EOS_CELL_MTYPE_MASK) >> 4;
+
+ if (idx < EOS_CELL_MAX_MTYPE) return evt_handler[idx];
+ return NULL;
+}