summaryrefslogtreecommitdiff
path: root/ecp/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'ecp/src/platform')
-rw-r--r--ecp/src/platform/fe310/time.c10
-rw-r--r--ecp/src/platform/fe310/transport.c6
-rw-r--r--ecp/src/platform/posix/features.mk3
-rw-r--r--ecp/src/platform/posix/time.c11
-rw-r--r--ecp/src/platform/posix/transport.c17
5 files changed, 26 insertions, 21 deletions
diff --git a/ecp/src/platform/fe310/time.c b/ecp/src/platform/fe310/time.c
index 5e4bc26..4bf530c 100644
--- a/ecp/src/platform/fe310/time.c
+++ b/ecp/src/platform/fe310/time.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
-#include <core.h>
-#include <tr.h>
+#include <ecp/core.h>
+#include <ecp/tm.h>
#include <eos/eos.h>
#include <eos/event.h>
@@ -23,7 +23,11 @@ int ecp_tm_init(ECPContext *ctx) {
return ECP_OK;
}
-ecp_sts_t ecp_tm_get_tick(void) {
+ecp_sts_t ecp_tm_get_s(void) {
+ return eos_time_get_tick() / EOS_TIMER_RTC_FREQ;
+}
+
+ecp_sts_t ecp_tm_get_ms(void) {
return eos_time_get_tick() * 1000 / EOS_TIMER_RTC_FREQ;
}
diff --git a/ecp/src/platform/fe310/transport.c b/ecp/src/platform/fe310/transport.c
index c359bd1..bc758c9 100644
--- a/ecp/src/platform/fe310/transport.c
+++ b/ecp/src/platform/fe310/transport.c
@@ -2,8 +2,8 @@
#include <string.h>
#include <stdio.h>
-#include <core.h>
-#include <tr.h>
+#include <ecp/core.h>
+#include <ecp/tr.h>
#include <eos/eos.h>
#include <eos/dev/net.h>
@@ -65,7 +65,7 @@ int ecp_tr_addr_set(ecp_tr_addr_t *addr, void *addr_s) {
return ECP_ERR;
}
-int ecp_tr_open(ECPSocket *sock, void *addr_s) {
+int ecp_tr_open(ECPSocket *sock, ecp_tr_addr_t *addr) {
sock->sock = eos_sock_open_udp(packet_handler, NULL);
if (sock->sock < 0) {
sock->sock = 0;
diff --git a/ecp/src/platform/posix/features.mk b/ecp/src/platform/posix/features.mk
index 2ce8220..ea5e44c 100644
--- a/ecp/src/platform/posix/features.mk
+++ b/ecp/src/platform/posix/features.mk
@@ -1,7 +1,8 @@
with_pthread = yes
with_htable = yes
with_vconn = yes
-with_dirsrv = yes
+with_frag = yes
with_rbuf = yes
with_msgq = yes
+with_dir = yes
with_debug = yes
diff --git a/ecp/src/platform/posix/time.c b/ecp/src/platform/posix/time.c
index 7030bf3..49a85e7 100644
--- a/ecp/src/platform/posix/time.c
+++ b/ecp/src/platform/posix/time.c
@@ -1,15 +1,20 @@
#include <stdlib.h>
#include <unistd.h>
+#include <time.h>
#include <sys/time.h>
-#include <core.h>
-#include <tm.h>
+#include <ecp/core.h>
+#include <ecp/tm.h>
int ecp_tm_init(ECPContext *ctx) {
return ECP_OK;
}
-ecp_sts_t ecp_tm_get_tick(void) {
+ecp_sts_t ecp_tm_get_s(void) {
+ return time(NULL);
+}
+
+ecp_sts_t ecp_tm_get_ms(void) {
struct timeval tv;
ecp_sts_t ms_now;
diff --git a/ecp/src/platform/posix/transport.c b/ecp/src/platform/posix/transport.c
index ebfbc7b..51f311a 100644
--- a/ecp/src/platform/posix/transport.c
+++ b/ecp/src/platform/posix/transport.c
@@ -6,8 +6,8 @@
#include <arpa/inet.h>
#include <poll.h>
-#include <core.h>
-#include <tr.h>
+#include <ecp/core.h>
+#include <ecp/tr.h>
#define MAX_ADDR_STR 32
@@ -49,20 +49,15 @@ int ecp_tr_addr_set(ecp_tr_addr_t *addr, void *addr_s) {
return 0;
}
-int ecp_tr_open(ECPSocket *sock, void *addr_s) {
+int ecp_tr_open(ECPSocket *sock, ecp_tr_addr_t *addr) {
struct sockaddr_in _myaddr;
int rv;
memset((char *)&_myaddr, 0, sizeof(_myaddr));
_myaddr.sin_family = AF_INET;
- if (addr_s) {
- ecp_tr_addr_t addr;
-
- rv = ecp_tr_addr_set(&addr, addr_s);
- if (rv) return rv;
-
- memcpy((void *)&_myaddr.sin_addr, addr.host, sizeof(addr.host));
- _myaddr.sin_port = addr.port;
+ if (addr) {
+ memcpy((void *)&_myaddr.sin_addr, addr->host, sizeof(addr->host));
+ _myaddr.sin_port = addr->port;
} else {
_myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
_myaddr.sin_port = htons(0);