summaryrefslogtreecommitdiff
path: root/code/esp32/components/eos/include
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2019-12-04 06:12:15 +0100
committerUros Majstorovic <majstor@majstor.org>2019-12-04 06:12:15 +0100
commit4c28fb525edc64fa16c6c3bf10929dca65d9c77c (patch)
tree2531b3bcc2d06c655f6eb9a6233696f5eadfa089 /code/esp32/components/eos/include
parent31578e285a21a749a49e3ac146feb8b02fcc7b52 (diff)
esp32 refactoring
Diffstat (limited to 'code/esp32/components/eos/include')
-rw-r--r--code/esp32/components/eos/include/eos.h15
-rw-r--r--code/esp32/components/eos/include/i2c.h1
-rw-r--r--code/esp32/components/eos/include/modem.h2
-rw-r--r--code/esp32/components/eos/include/msgq.h11
-rw-r--r--code/esp32/components/eos/include/net.h31
-rw-r--r--code/esp32/components/eos/include/pcm.h1
-rw-r--r--code/esp32/components/eos/include/transport.h13
-rw-r--r--code/esp32/components/eos/include/wifi.h9
8 files changed, 43 insertions, 40 deletions
diff --git a/code/esp32/components/eos/include/eos.h b/code/esp32/components/eos/include/eos.h
index 1b52605..a21985a 100644
--- a/code/esp32/components/eos/include/eos.h
+++ b/code/esp32/components/eos/include/eos.h
@@ -1,8 +1,9 @@
-#define EOS_OK 0
-#define EOS_ERR -1
-#define EOS_ERR_Q_FULL -10
+#define EOS_OK 0
+#define EOS_ERR -1
+#define EOS_ERR_Q_FULL -10
-#define EOS_PRIORITY_WIFI 1
-#define EOS_PRIORITY_SPI 1
-#define EOS_PRIORITY_PCM 1
-#define EOS_PRIORITY_MODEM 1 \ No newline at end of file
+
+#define EOS_IRQ_PRIORITY_UART 1
+#define EOS_IRQ_PRIORITY_I2S 1
+#define EOS_IRQ_PRIORITY_NET_XCHG 1
+#define EOS_IRQ_PRIORITY_UDP_RCVR 1
diff --git a/code/esp32/components/eos/include/i2c.h b/code/esp32/components/eos/include/i2c.h
index 6f89654..995a77e 100644
--- a/code/esp32/components/eos/include/i2c.h
+++ b/code/esp32/components/eos/include/i2c.h
@@ -1,3 +1,4 @@
+#include <sys/types.h>
#include <stdint.h>
void eos_i2c_init(void);
diff --git a/code/esp32/components/eos/include/modem.h b/code/esp32/components/eos/include/modem.h
index 424c0db..6a80918 100644
--- a/code/esp32/components/eos/include/modem.h
+++ b/code/esp32/components/eos/include/modem.h
@@ -1,4 +1,4 @@
-#include <stdint.h>
+#include <sys/types.h>
void eos_modem_init(void);
ssize_t eos_modem_write(void *data, size_t size); \ No newline at end of file
diff --git a/code/esp32/components/eos/include/msgq.h b/code/esp32/components/eos/include/msgq.h
index ebf54ce..9c9c757 100644
--- a/code/esp32/components/eos/include/msgq.h
+++ b/code/esp32/components/eos/include/msgq.h
@@ -1,11 +1,10 @@
#include <stdint.h>
-#include "fe310.h"
-
typedef struct EOSMsgItem {
- unsigned char cmd;
- unsigned char buffer[EOS_FE310_SIZE_BUF];
+ unsigned char type;
+ unsigned char *buffer;
uint16_t len;
+ uint8_t flags;
} EOSMsgItem;
typedef struct EOSMsgQ {
@@ -16,5 +15,5 @@ typedef struct EOSMsgQ {
} EOSMsgQ;
void eos_msgq_init(EOSMsgQ *msgq, EOSMsgItem *array, uint8_t size);
-int eos_msgq_push(EOSMsgQ *msgq, unsigned char cmd, unsigned char *buffer, uint16_t len);
-void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *cmd, unsigned char **buffer, uint16_t *len);
+int eos_msgq_push(EOSMsgQ *msgq, unsigned char type, unsigned char *buffer, uint16_t len, uint8_t flags);
+void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *type, unsigned char **buffer, uint16_t *len, uint8_t *flags);
diff --git a/code/esp32/components/eos/include/net.h b/code/esp32/components/eos/include/net.h
index 21b12dc..3ce142a 100644
--- a/code/esp32/components/eos/include/net.h
+++ b/code/esp32/components/eos/include/net.h
@@ -1,19 +1,24 @@
#include <stdint.h>
-#define EOS_FE310_CMD_FLAG_ONEW 0x10
+#define EOS_NET_MTYPE_SOCK 1
+#define EOS_NET_MTYPE_AUDIO 2
-#define EOS_FE310_CMD_WIFI_CONNECT 1
-#define EOS_FE310_CMD_WIFI_DISCONNECT 2
-#define EOS_FE310_CMD_WIFI_SCAN 3
-#define EOS_FE310_CMD_WIFI_PKT 4
-#define EOS_FE310_CMD_MODEM_DATA 5
-#define EOS_FE310_CMD_MODEM_CALL 6
+#define EOS_NET_MTYPE_WIFI 5
+#define EOS_NET_MTYPE_CELL 6
+#define EOS_NET_MTYPE_SIP 7
+#define EOS_NET_MTYPE_APP 8
-#define EOS_FE310_MAX_CMD 8
-#define EOS_FE310_SIZE_Q 64
-#define EOS_FE310_SIZE_BUF 2048
+#define EOS_NET_MAX_MTYPE 8
-typedef void (*eos_fe310_fptr_t) (unsigned char, unsigned char *, uint16_t);
+#define EOS_NET_MTYPE_FLAG_ONEW 0x10
-void eos_fe310_init(void);
-int eos_fe310_send(unsigned char cmd, unsigned char *buffer, uint16_t len);
+#define EOS_NET_SIZE_BUF 1500
+#define EOS_NET_SIZE_BUFQ 64
+
+#define EOS_NET_FLAG_BUF_FREE 0x01
+
+typedef void (*eos_net_fptr_t) (unsigned char, unsigned char *, uint16_t);
+
+void eos_net_init(void);
+int eos_net_send(unsigned char mtype, unsigned char *buffer, uint16_t len, uint8_t flags);
+void eos_net_set_handler(unsigned char mtype, eos_net_fptr_t handler); \ No newline at end of file
diff --git a/code/esp32/components/eos/include/pcm.h b/code/esp32/components/eos/include/pcm.h
index ef8a303..dcccea7 100644
--- a/code/esp32/components/eos/include/pcm.h
+++ b/code/esp32/components/eos/include/pcm.h
@@ -1,3 +1,4 @@
+#include <sys/types.h>
#include <stdint.h>
void eos_pcm_init(void);
diff --git a/code/esp32/components/eos/include/transport.h b/code/esp32/components/eos/include/transport.h
deleted file mode 100644
index 356014d..0000000
--- a/code/esp32/components/eos/include/transport.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdint.h>
-
-#define EOS_IPv4_ADDR_SIZE 4
-
-typedef struct EOSNetAddr {
- unsigned char host[EOS_IPv4_ADDR_SIZE];
- uint16_t port;
-} EOSNetAddr;
-
-void eos_wifi_init(void);
-void eos_wifi_connect(char *ssid, char *password);
-void eos_wifi_disconnect(void);
-ssize_t eos_wifi_send(void *msg, size_t msg_size, EOSNetAddr *addr);
diff --git a/code/esp32/components/eos/include/wifi.h b/code/esp32/components/eos/include/wifi.h
new file mode 100644
index 0000000..42c77bd
--- /dev/null
+++ b/code/esp32/components/eos/include/wifi.h
@@ -0,0 +1,9 @@
+#define EOS_WIFI_MTYPE_SCAN 0
+#define EOS_WIFI_MTYPE_CONNECT 1
+#define EOS_WIFI_MTYPE_DISCONNECT 2
+
+#define EOS_WIFI_MAX_MTYPE 3
+
+void eos_wifi_init(void);
+void eos_wifi_connect(char *ssid, char *pass);
+void eos_wifi_disconnect(void);