summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/dev/net.h
blob: ad544a3eafa99b8ce83b6593c3f1927e1322e3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdint.h>

#include "../event.h"

#define EOS_NET_MTU                 1500

#define EOS_NET_MTYPE_BRIDGE        0       /* handler only */
#define EOS_NET_MTYPE_WIFI          1
#define EOS_NET_MTYPE_CELL          2
#define EOS_NET_MTYPE_SOCK          3
#define EOS_NET_MTYPE_RNG           4

#define EOS_NET_MAX_MTYPE           5

#define EOS_NET_MTYPE_SLEEP         0x20    /* does not have net handler */

#define EOS_NET_MTYPE_FLAG_ONEW     0x80
#define EOS_NET_MTYPE_FLAG_REPL     0x40
#define EOS_NET_MTYPE_FLAG_BRIDGE   0x08

#define EOS_NET_MTYPE_MASK          0x0F    /* must be the same as ~EOS_EVT_MASK */

#define EOS_NET_FLAG_MORE           0x01
#define EOS_NET_FLAG_SYNC           0x02
#define EOS_NET_FLAG_REPL           0x04

int eos_net_init(void);
int eos_net_run(void);
void eos_net_start(void);
void eos_net_stop(void);
int eos_net_sleep(void);
int eos_net_sleep_rdy(void);
void eos_net_wake(void);

void eos_net_bad_handler(unsigned char type, EOSMessage *msg, uint16_t len);
void eos_net_set_handler(unsigned char type, eos_evt_handler_t handler);
void eos_net_acquire_for_evt(unsigned char type, int acq);

void eos_net_acquire(void);
void eos_net_release(void);
void eos_net_alloc(EOSMessage *msg);
void eos_net_free(EOSMessage *msg, int more);
int eos_net_send(unsigned char type, EOSMessage *msg, uint16_t len, int more);
int eos_net_send_sync(unsigned char type, EOSMessage *msg, uint16_t len);
int eos_net_xchg(unsigned char *type, EOSMessage *msg, uint16_t *len);
int _eos_net_send(unsigned char type, EOSMessage *msg, uint16_t len, unsigned char flags);