diff options
author | Uros Majstorovic <majstor@majstor.org> | 2018-01-11 21:28:22 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2018-01-11 21:28:22 +0100 |
commit | 0d0e9facfcea3cf96da3b63285865182fdd5477e (patch) | |
tree | cca42e7aab184cad981c794073a4376aa2616193 /code/core/fe310 | |
parent | 05e11f491b84a110b9ca08612df370b91e9bdcbc (diff) |
refatoring dirs
Diffstat (limited to 'code/core/fe310')
-rw-r--r-- | code/core/fe310/Makefile | 20 | ||||
-rw-r--r-- | code/core/fe310/time.c | 18 | ||||
-rw-r--r-- | code/core/fe310/transport.c | 46 | ||||
-rw-r--r-- | code/core/fe310/transport.h | 10 |
4 files changed, 0 insertions, 94 deletions
diff --git a/code/core/fe310/Makefile b/code/core/fe310/Makefile deleted file mode 100644 index 6dd42e2..0000000 --- a/code/core/fe310/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -include ../../Makefile.platform -CFLAGS=$(CFLAGS_PL) $(PIC) -I.. - -obj_tr = transport.o -obj_tm = time.o - - -%.o: %.c - $(CC) $(CFLAGS) -c $< - -all: libecptr.a libecptm.a - -libecptr.a: $(obj_tr) - $(AR) rcs libecptr.a $(obj_tr) - -libecptm.a: $(obj_tm) - $(AR) rcs libecptm.a $(obj_tm) - -clean: - rm -f *.o *.a diff --git a/code/core/fe310/time.c b/code/core/fe310/time.c deleted file mode 100644 index 2ff98cb..0000000 --- a/code/core/fe310/time.c +++ /dev/null @@ -1,18 +0,0 @@ -#include <core.h> - -#include "encoding.h" -#include "platform.h" - -static ecp_cts_t t_abstime_ms(ecp_cts_t msec) { - volatile uint64_t *mtime = (uint64_t *) (CLINT_CTRL_ADDR + CLINT_MTIME); - - uint64_t now_ms = *mtime * 1000 / RTC_FREQ; - return now_ms + msec; -} - -int ecp_time_init(ECPTimeIface *t) { - t->init = 1; - t->abstime_ms = t_abstime_ms; - t->sleep_ms = NULL; - return 0; -} diff --git a/code/core/fe310/transport.c b/code/core/fe310/transport.c deleted file mode 100644 index b833ee3..0000000 --- a/code/core/fe310/transport.c +++ /dev/null @@ -1,46 +0,0 @@ -#include <stddef.h> -#include <string.h> - -#include <core.h> - -#include "eos.h" -#include "net.h" - -static int t_addr_eq(ECPNetAddr *addr1, ECPNetAddr *addr2) { - if (addr1->port != addr2->port) return 0; - if (memcmp(addr1->host, addr2->host, sizeof(addr1->host)) != 0) return 0; - return 1; -} - -static int t_open(int *sock, void *addr_s) { - *sock = 0; - return ECP_OK; -} - -static void t_close(int *sock) { -} - -static ssize_t t_send(int *sock, void *msg, size_t msg_size, ECPNetAddr *addr) { - unsigned char *buf = msg; - size_t addr_len = sizeof(addr->host) + sizeof(addr->port); - uint16_t buf_size = msg_size + addr_len; - int rv; - - buf -= addr_len; - memcpy(buf, addr->host, sizeof(addr->host)); - memcpy(buf+sizeof(addr->host), &addr->port, sizeof(addr->port)); - rv = eos_net_send(EOS_NET_CMD_PKT, buf, buf_size); - if (rv) return ECP_ERR_SEND; - return msg_size; -} - -int ecp_transport_init(ECPTransportIface *t) { - t->init = 1; - t->open = t_open; - t->close = t_close; - t->send = t_send; - t->recv = NULL; - t->addr_eq = t_addr_eq; - t->addr_set = NULL; - return ECP_OK; -} diff --git a/code/core/fe310/transport.h b/code/core/fe310/transport.h deleted file mode 100644 index c35e13e..0000000 --- a/code/core/fe310/transport.h +++ /dev/null @@ -1,10 +0,0 @@ -#include <stdint.h> - -#define ECP_IPv4_ADDR_SIZE 4 - -typedef int ECPNetSock; -typedef struct ECPNetAddr { - unsigned char host[ECP_IPv4_ADDR_SIZE]; - uint16_t port; -} ECPNetAddr; - |