summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/cell.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-05-13 12:45:53 +0200
committerUros Majstorovic <majstor@majstor.org>2022-05-13 12:45:53 +0200
commit412a8f99928beff605805807b0f07f6bf8d0a965 (patch)
tree366f1768ddfd32960c5d26ca3fba14e82c3b571e /fw/fe310/eos/cell.c
parent9ccb4db8d59ec9dab33ee8617d462f21a8bb4fa8 (diff)
code rename
Diffstat (limited to 'fw/fe310/eos/cell.c')
-rw-r--r--fw/fe310/eos/cell.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/fw/fe310/eos/cell.c b/fw/fe310/eos/cell.c
deleted file mode 100644
index 20a9f42..0000000
--- a/fw/fe310/eos/cell.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "eos.h"
-#include "event.h"
-#include "net.h"
-
-#include "cell.h"
-
-static eos_evt_handler_t evt_handler[EOS_CELL_MAX_MTYPE];
-
-static void cell_handle_msg(unsigned char type, unsigned char *buffer, uint16_t len) {
- unsigned char mtype;
- unsigned char idx;
-
- if ((buffer == NULL) || (len < 1)) {
- eos_net_bad_handler(type, buffer, len);
- return;
- }
-
- mtype = buffer[0];
- idx = (mtype & EOS_CELL_MTYPE_MASK) >> 4;
- if ((idx < EOS_CELL_MAX_MTYPE) && evt_handler[idx]) {
- evt_handler[idx](mtype & ~EOS_CELL_MTYPE_MASK, buffer, len);
- } else {
- eos_net_bad_handler(type, buffer, len);
- }
-}
-
-void eos_cell_netinit(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_msg);
-}
-
-void eos_cell_set_handler(unsigned char mtype, eos_evt_handler_t handler) {
- unsigned char idx = (mtype & EOS_CELL_MTYPE_MASK) >> 4;
-
- 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;
-}