From 789dadd8bf83ba3243384d47339852ca170566fc Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 17 Jun 2019 21:17:52 +0200 Subject: [PATCH] liteeth/software: remove libwip/libuip examples. libuip integration can be found in https://github.com/timvideos/HDMI2USB-litex-firmware/tree/master/firmware --- liteeth/software/liblwip/Makefile | 55 ------ liteeth/software/liblwip/arch/cc.h | 60 ------- liteeth/software/liblwip/arch/perf.h | 11 -- liteeth/software/liblwip/arch/sys_arch.h | 20 --- liteeth/software/liblwip/lwipopts.h | 184 --------------------- liteeth/software/liblwip/netif/liteethif.c | 148 ----------------- liteeth/software/liblwip/netif/liteethif.h | 17 -- liteeth/software/libuip/Makefile | 76 --------- liteeth/software/libuip/clock-arch.c | 29 ---- liteeth/software/libuip/clock-arch.h | 10 -- liteeth/software/libuip/contiki-conf.h | 38 ----- liteeth/software/libuip/liteethmac-drv.c | 95 ----------- liteeth/software/libuip/liteethmac-drv.h | 11 -- liteeth/software/libuip/rtimer-arch.c | 38 ----- liteeth/software/libuip/rtimer-arch.h | 16 -- 15 files changed, 808 deletions(-) delete mode 100644 liteeth/software/liblwip/Makefile delete mode 100644 liteeth/software/liblwip/arch/cc.h delete mode 100644 liteeth/software/liblwip/arch/perf.h delete mode 100644 liteeth/software/liblwip/arch/sys_arch.h delete mode 100644 liteeth/software/liblwip/lwipopts.h delete mode 100644 liteeth/software/liblwip/netif/liteethif.c delete mode 100644 liteeth/software/liblwip/netif/liteethif.h delete mode 100644 liteeth/software/libuip/Makefile delete mode 100644 liteeth/software/libuip/clock-arch.c delete mode 100644 liteeth/software/libuip/clock-arch.h delete mode 100644 liteeth/software/libuip/contiki-conf.h delete mode 100644 liteeth/software/libuip/liteethmac-drv.c delete mode 100644 liteeth/software/libuip/liteethmac-drv.h delete mode 100644 liteeth/software/libuip/rtimer-arch.c delete mode 100644 liteeth/software/libuip/rtimer-arch.h diff --git a/liteeth/software/liblwip/Makefile b/liteeth/software/liblwip/Makefile deleted file mode 100644 index 0aaabd9..0000000 --- a/liteeth/software/liblwip/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -include $(MSCDIR)/software/common.mak - -LWIPDIR=../lwip/src - -CFLAGS += $(CPPFLAGS) -I. \ - -I$(LWIPDIR)/include \ - -I$(LWIPDIR)/include/ipv4 - -# COREFILES, CORE4FILES: The minimum set of files needed for lwIP. -COREOBJS=$(LWIPDIR)/core/mem.o \ - $(LWIPDIR)/core/memp.o \ - $(LWIPDIR)/core/netif.o \ - $(LWIPDIR)/core/pbuf.o \ - $(LWIPDIR)/core/raw.o \ - $(LWIPDIR)/core/stats.o \ - $(LWIPDIR)/core/sys.o \ - $(LWIPDIR)/core/tcp.o \ - $(LWIPDIR)/core/tcp_in.o \ - $(LWIPDIR)/core/tcp_out.o \ - $(LWIPDIR)/core/udp.o \ - $(LWIPDIR)/core/dhcp.o \ - $(LWIPDIR)/core/inet_chksum.o \ - $(LWIPDIR)/core/timers.o \ - $(LWIPDIR)/core/init.o - -CORE4OBJS=$(LWIPDIR)/core/ipv4/icmp.o \ - $(LWIPDIR)/core/ipv4/ip4.o \ - $(LWIPDIR)/core/ipv4/ip4_addr.o \ - $(LWIPDIR)/core/ipv4/ip_frag.o - -# NETIFOBJS: Files implementing various generic network interface functions. -NETIFOBJS=$(LWIPDIR)/netif/etharp.o \ - netif/liteethif.o - -# LWIPOBJS: All the above. -LWIPOBJS=$(COREOBJS) $(CORE4OBJS) $(NETIFOBJS) -OBJS_LIB+=$(LWIPOBJS) - -LWIPLIB=liblwip.a - -all: $(LWIPLIB) - -.PHONY: all compile clean - -%.o: %.c - $(compile-dep) - -%.o: %.S - $(assemble) - -clean: - rm -f $(LWIPOBJS) $(LWIPOBJS:.o=.d) $(LWIPLIB) - -liblwip.a: $(LWIPOBJS) - $(AR) clr liblwip.a $(LWIPOBJS) diff --git a/liteeth/software/liblwip/arch/cc.h b/liteeth/software/liblwip/arch/cc.h deleted file mode 100644 index 9a639f0..0000000 --- a/liteeth/software/liblwip/arch/cc.h +++ /dev/null @@ -1,60 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// LiteETH lwIP port -// License: BSD - -#ifndef __ARCH_CC_H__ -#define __ARCH_CC_H__ - -/* Include some files for defining library routines */ -#include -#include -#include - -#define BYTE_ORDER BIG_ENDIAN - -/* Define generic types */ -typedef unsigned char u8_t; -typedef signed char s8_t; -typedef unsigned short u16_t; -typedef signed short s16_t; -typedef unsigned long u32_t; -typedef signed long s32_t; - -typedef u32_t mem_ptr_t; - -/* Define (sn)printf formatters for these types */ -#define U8_F "c" -#define S8_F "c" -#define X8_F "x" -#define U16_F "u" -#define S16_F "d" -#define X16_F "x" -#define U32_F "u" -#define S32_F "d" -#define X32_F "x" - -/* Compiler hints for packing structures */ -#define PACK_STRUCT_FIELD(x) x -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -/* prototypes for printf() and abort() */ -#include -#include -#include "console.h" -#define pp_printf printf - -/* Definitions for ASSERT/DIAG */ -#ifdef LWIP_NOASSERT -#define LWIP_PLATFORM_ASSERT(x) -#else -#define LWIP_PLATFORM_ASSERT(x) do {pp_printf("Assertion \"%s\" failed at line %d in %s\n", \ - x, __LINE__, __FILE__); } while(0) -#endif - -#ifdef LWIP_DEBUG -#define LWIP_PLATFORM_DIAG(x) do {pp_printf x;} while(0) -#endif - -#endif /* __ARCH_CC_H__ */ diff --git a/liteeth/software/liblwip/arch/perf.h b/liteeth/software/liblwip/arch/perf.h deleted file mode 100644 index 228bc43..0000000 --- a/liteeth/software/liblwip/arch/perf.h +++ /dev/null @@ -1,11 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// LiteETH lwIP port -// License: BSD - -#ifndef __ARCH_PERF_H__ -#define __ARCH_PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __ARCH_PERF_H__ */ diff --git a/liteeth/software/liblwip/arch/sys_arch.h b/liteeth/software/liblwip/arch/sys_arch.h deleted file mode 100644 index 335292e..0000000 --- a/liteeth/software/liblwip/arch/sys_arch.h +++ /dev/null @@ -1,20 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// LiteETH lwIP port -// License: BSD - -#ifndef __ARCH_SYS_ARCH_H__ -#define __ARCH_SYS_ARCH_H__ - -#define SYS_MBOX_NULL NULL -#define SYS_SEM_NULL NULL - -typedef void * sys_prot_t; - -typedef void * sys_sem_t; - -typedef void * sys_mbox_t; - -typedef void * sys_thread_t; - -#endif /* __ARCH_SYS_ARCH_H__ */ - diff --git a/liteeth/software/liblwip/lwipopts.h b/liteeth/software/liblwip/lwipopts.h deleted file mode 100644 index 147322d..0000000 --- a/liteeth/software/liblwip/lwipopts.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ - -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define NO_SYS 1 -#define LWIP_NETCONN 0 -#define LWIP_SOCKET 0 -#define LWIP_IPV6 0 - -#define LWIP_CALLBACK_API 1 - -/* -------- TCP Timer Intervals ------- */ -#define TCP_TMR_INTERVAL 1 /* The TCP timer interval in - milliseconds. */ - -#define TCP_FAST_INTERVAL 2 /* the fine grained timeout in - milliseconds */ - -#define TCP_SLOW_INTERVAL 5 /* the coarse grained timeout in - milliseconds */ - -/* ---------- Memory options ---------- */ -/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which - lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 - byte alignment -> define MEM_ALIGNMENT to 2. */ -#define MEM_ALIGNMENT 4 - -/* MEM_SIZE: the size of the heap memory. If the application will send -a lot of data that needs to be copied, this should be set high. */ -#define MEM_SIZE 32 * 1024 - -/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application - sends a lot of data out of ROM (or other static memory), this - should be set high. */ -#define MEMP_NUM_PBUF 64 -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#define MEMP_NUM_UDP_PCB 2 -/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections. */ -#define MEMP_NUM_TCP_PCB 8 -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#define MEMP_NUM_TCP_PCB_LISTEN 16 -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#define MEMP_NUM_TCP_SEG 255 - -/* The following four are used only with the sequential API and can be - set to 0 if the application only will use the raw API. */ -/* MEMP_NUM_NETBUF: the number of struct netbufs. */ -#define MEMP_NUM_NETBUF 0 -/* MEMP_NUM_NETCONN: the number of struct netconns. */ -#define MEMP_NUM_NETCONN 0 -/* MEMP_NUM_TCPIP_MSG: the number of struct tcpip_msg, which is used - for sequential API communication and incoming packets. Used in - src/api/tcpip.c. */ -#define MEMP_NUM_TCPIP_MSG_API 0 -#define MEMP_NUM_TCPIP_MSG_INPKT 0 -/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts. */ -#define MEMP_NUM_SYS_TIMEOUT 5 - -/* ---------- Pbuf options ---------- */ -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 512 - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE 1536 - -/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a - link level header. */ -#define PBUF_LINK_HLEN 16 - -/* ---------- TCP options ---------- */ -#define LWIP_TCP 1 -#define LWIP_TCP_KEEPALIVE 1 -#define TCP_KEEPIDLE_DEFAULT 1250 -#define TCP_KEEPINTVL_DEFAULT 1000 -#define TCP_KEEPCNT_DEFAULT 3 -#define TCP_TTL 255 - -/* Controls if TCP should queue segments that arrive out of - order. Define to 0 if your device is low on memory. */ -#define TCP_QUEUE_OOSEQ 1 - -/* TCP Maximum segment size. */ -#define TCP_MSS 1476 - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 32 * 1024 - -/* TCP sender buffer space (pbufs). */ -#define TCP_SND_QUEUELEN 3 * TCP_SND_BUF/TCP_MSS - -/* TCP receive window. */ -#define TCP_WND 16 * 1024 - -/* Maximum number of retransmissions of data segments. */ -#define TCP_MAXRTX 12 - -/* Maximum number of retransmissions of SYN segments. */ -#define TCP_SYNMAXRTX 4 - -/* ---------- ARP options ---------- */ -#define ARP_TABLE_SIZE 10 -#define ARP_QUEUEING 1 - -/* ---------- IP options ---------- */ -/* Define IP_FORWARD to 1 if you wish to have the ability to forward - IP packets across network interfaces. If you are going to run lwIP - on a device with only one network interface, define this to 0. */ -#define IP_FORWARD 0 - -/* If defined to 1, IP options are allowed (but not parsed). If - defined to 0, all packets with IP options are dropped. */ -#define IP_OPTIONS 1 - -/* ---------- ICMP options ---------- */ -#define ICMP_TTL 255 - - -/* ---------- DHCP options ---------- */ -/* Define LWIP_DHCP to 1 if you want DHCP configuration of - interfaces. DHCP is not implemented in lwIP 0.5.1, however, so - turning this on does currently not work. */ -#define LWIP_DHCP 0 - -/* 1 if you want to do an ARP check on the offered address - (recommended). */ -#define DHCP_DOES_ARP_CHECK 0 - -/* ---------- UDP options ---------- */ -#define LWIP_UDP 1 -#define UDP_TTL 255 - - -/* ---------- Statistics options ---------- */ -/*#define STATS*/ - -#ifdef STATS -#define LINK_STATS -#define IP_STATS -#define ICMP_STATS -#define UDP_STATS -#define TCP_STATS -#define MEM_STATS -#define MEMP_STATS -#define PBUF_STATS -#define SYS_STATS -#endif /* STATS */ - -#endif /* __LWIPOPTS_H__ */ diff --git a/liteeth/software/liblwip/netif/liteethif.c b/liteeth/software/liblwip/netif/liteethif.c deleted file mode 100644 index 2c8f56f..0000000 --- a/liteeth/software/liblwip/netif/liteethif.c +++ /dev/null @@ -1,148 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// LiteETH lwIP port -// License: BSD - -#include -#include - -#ifdef CSR_ETHMAC_BASE - -#include -#include - -#include -#include "netif/liteethif.h" - -#include - -#define ETHMAC_RX0_BASE ETHMAC_BASE -#define ETHMAC_RX1_BASE (ETHMAC_BASE+0x0800) -#define ETHMAC_TX0_BASE (ETHMAC_BASE+0x1000) -#define ETHMAC_TX1_BASE (ETHMAC_BASE+0x1800) - -static unsigned int rxslot; -static unsigned int rxlen; -static char *rxbuffer; -static char *rxbuffer0; -static char *rxbuffer1; -static unsigned int txslot; -static unsigned int txlen; -static char *txbuffer; -static char *txbuffer0; -static char *txbuffer1; - -#define IFNAME0 'e' -#define IFNAME1 't' - -static void liteeth_low_level_init(struct netif *netif) -{ - int i; - - netif->hwaddr_len = 6; - for(i=0;ihwaddr_len;i++) - netif->hwaddr[i] = macadr[i]; - netif->mtu = 1514; - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP; - - ethmac_sram_reader_ev_pending_write(ETHMAC_EV_SRAM_READER); - ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER); - - rxbuffer0 = (char *)ETHMAC_RX0_BASE; - rxbuffer1 = (char *)ETHMAC_RX1_BASE; - txbuffer0 = (char *)ETHMAC_TX0_BASE; - txbuffer1 = (char *)ETHMAC_TX1_BASE; - - rxslot = 0; - txslot = 0; - - rxbuffer = rxbuffer0; - txbuffer = txbuffer0; -} - -static err_t liteeth_low_level_output(struct netif *netif, struct pbuf *p) -{ - struct pbuf *q; - - txlen = 0; - q = p; - while(q) { - memcpy(txbuffer, q->payload, q->len); - txbuffer += q->len; - txlen += q->len; - if(q->tot_len != q->len) - q = q->next; - else - q = NULL; - } - - ethmac_sram_reader_slot_write(txslot); - ethmac_sram_reader_length_write(txlen); - while(!ethmac_sram_reader_ready_read()); - ethmac_sram_reader_start_write(1); - - txslot = (txslot + 1) % 2; - if(txslot) - txbuffer = txbuffer1; - else - txbuffer = txbuffer0; - - return ERR_OK; -} - -static struct pbuf *liteeth_low_level_input(struct netif *netif) -{ - struct pbuf *p, *q; - - rxslot = ethmac_sram_writer_slot_read(); - rxlen = ethmac_sram_writer_length_read(); - if(rxslot) - rxbuffer = rxbuffer1; - else - rxbuffer = rxbuffer0; - - p = pbuf_alloc(PBUF_RAW, rxlen, PBUF_POOL); - q = p; - while(q) { - memcpy(q->payload, rxbuffer, q->len); - rxbuffer += q->len; - if(q->tot_len != q->len) - q = q->next; - else - q = NULL; - } - - return p; -} - -void liteeth_input(struct netif *netif) -{ - struct pbuf *p; - p = liteeth_low_level_input(netif); - if(p != NULL) - netif->input(p, netif); -} - -err_t liteeth_init(struct netif *netif) -{ - struct liteethif *liteethif; - - liteethif = mem_malloc(sizeof(struct liteethif)); - if(liteethif == NULL) - return ERR_MEM; - netif->state = liteethif; - - netif->hwaddr_len = 6; - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - netif->output = etharp_output; - netif->linkoutput = liteeth_low_level_output; - netif->mtu = 1514; - - liteethif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - - liteeth_low_level_init(netif); - - return ERR_OK; -} - -#endif /* CSR_ETHMAC_BASE */ diff --git a/liteeth/software/liblwip/netif/liteethif.h b/liteeth/software/liblwip/netif/liteethif.h deleted file mode 100644 index 874dfcb..0000000 --- a/liteeth/software/liblwip/netif/liteethif.h +++ /dev/null @@ -1,17 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// LiteETH lwIP port -// License: BSD - -#ifndef __LITEETHIF_H__ -#define __LITEETHIF_H__ - -extern unsigned char macadr[]; - -struct liteethif { - struct eth_addr *ethaddr; -}; - -void liteeth_input(struct netif *netif); -err_t liteeth_init(struct netif *netif); - -#endif /* __LITEETH_IF_H__ */ diff --git a/liteeth/software/libuip/Makefile b/liteeth/software/libuip/Makefile deleted file mode 100644 index cc69877..0000000 --- a/liteeth/software/libuip/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# XXX remove this -MSCDIR=../../../../misoc -include $(MSCDIR)/software/common.mak - -UIPDIR=../uip -LIBUIPDIR=../libuip - -CFLAGS += $(CPPFLAGS) -I. \ - -I$(UIPDIR) \ - -I$(UIPDIR)/net \ - -I$(UIPDIR)/net\ip \ - -I$(UIPDIR)/net\ipv4 \ - -Wno-char-subscripts \ - -fno-strict-aliasing -fpack-struct - -#See here for-fno-strict-aliasing -fpack-struct: -#http://sourceforge.net/p/contiki/mailman/message/28002063/ - -CCDEP=$(CC) - -UIPCOREOBJS=$(UIPDIR)/net/ip/dhcpc.o \ - $(UIPDIR)/net/ip/psock.o \ - $(UIPDIR)/net/ip/resolv.o \ - $(UIPDIR)/net/ip/simple-udp.o \ - $(UIPDIR)/net/ip/slipdev.o \ - $(UIPDIR)/net/ip/tcpip.o \ - $(UIPDIR)/net/ip/tcp-socket.o \ - $(UIPDIR)/net/ip/udp-socket.o \ - $(UIPDIR)/net/ip/uip-debug.o \ - $(UIPDIR)/net/ip/uiplib.o \ - $(UIPDIR)/net/ip/uip-packetqueue.o \ - $(UIPDIR)/net/ip/uip-split.o \ - $(UIPDIR)/net/ip/uip-udp-packet.o \ - $(UIPDIR)/net/ipv4/uaodv.o \ - $(UIPDIR)/net/ipv4/uaodv-rt.o \ - $(UIPDIR)/net/ipv4/uip.o \ - $(UIPDIR)/net/ipv4/uip_arp.o \ - $(UIPDIR)/net/ipv4/uip-fw.o \ - $(UIPDIR)/net/ipv4/uip-fw-drv.o \ - $(UIPDIR)/net/ipv4/uip-neighbor.o \ - $(UIPDIR)/net/ipv4/uip-over-mesh.o \ - $(UIPDIR)/net/linkaddr.o \ - $(UIPDIR)/net/nbr-table.o \ - $(UIPDIR)/net/netstack.o \ - $(UIPDIR)/net/packetbuf.o \ - $(UIPDIR)/net/queuebuf.o \ - $(UIPDIR)/sys/process.o \ - $(UIPDIR)/sys/etimer.o \ - $(UIPDIR)/sys/timer.o \ - $(UIPDIR)/lib/list.o - -UIPARCHOBJS=clock-arch.o \ - rtimer-arch.o \ - liteethmac-drv.o - -UIPOBJS=$(UIPCOREOBJS) $(UIPARCHOBJS) -OBJS_LIB+=$(UIPOBJS) - -UIPLIB=libuip.a - -all: $(UIPLIB) - -.PHONY: all compile clean - -%.o: %.c - $(compile-dep) - -%.o: %.S - $(assemble) - -clean: - rm -f $(UIPOBJS) $(UIPOBJS:.o=.d) libuip.a - -libuip.a: $(UIPOBJS) - $(AR) clr libuip.a $(UIPOBJS) - $(RANLIB) libuip.a diff --git a/liteeth/software/libuip/clock-arch.c b/liteeth/software/libuip/clock-arch.c deleted file mode 100644 index 6d7357f..0000000 --- a/liteeth/software/libuip/clock-arch.c +++ /dev/null @@ -1,29 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// License: BSD - -#include "contiki-conf.h" -#include "clock-arch.h" -#include - -/*-----------------------------------------------------------------------------------*/ -void clock_init(void) -{ - timer0_en_write(0); - timer0_load_write(0xffffffff); - timer0_reload_write(0xffffffff); - timer0_en_write(1); -} - -/*---------------------------------------------------------------------------*/ -clock_time_t clock_time(void) -{ - unsigned int freq; - unsigned int prescaler; - clock_time_t ticks; - - freq = identifier_frequency_read(); - prescaler = freq/CLOCK_CONF_SECOND; - timer0_update_value_write(1); - ticks = (0xffffffff - timer0_value_read())/prescaler; - return ticks; -} diff --git a/liteeth/software/libuip/clock-arch.h b/liteeth/software/libuip/clock-arch.h deleted file mode 100644 index 3b8d3a2..0000000 --- a/liteeth/software/libuip/clock-arch.h +++ /dev/null @@ -1,10 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// License: BSD - -#ifndef __CLOCK_ARCH_H__ -#define __CLOCK_ARCH_H__ - -void clock_init(void); -clock_time_t clock_time(void); - -#endif /* __CLOCK_ARCH_H__ */ diff --git a/liteeth/software/libuip/contiki-conf.h b/liteeth/software/libuip/contiki-conf.h deleted file mode 100644 index afd22e6..0000000 --- a/liteeth/software/libuip/contiki-conf.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CONTIKI_CONF_H__ -#define CONTIKI_CONF_H__ - -#include -#include - -#define CCIF -#define CLIF - -#define NETSTACK_CONF_WITH_IPV4 1 -#define WITH_ASCII 1 - -#define CLOCK_CONF_SECOND 128 - -typedef unsigned char u8_t; -typedef unsigned short u16_t; -typedef unsigned int u32_t; -typedef char s8_t; -typedef short s16_t; -typedef int s32_t; - -typedef unsigned int clock_time_t; -typedef unsigned int uip_stats_t; - -#ifndef BV -#define BV(x) (1<<(x)) -#endif - -/* uIP configuration */ -#define UIP_CONF_BYTE_ORDER UIP_BIG_ENDIAN -#define UIP_CONF_LLH_LEN 14 -#define UIP_CONF_BROADCAST 1 -#define UIP_CONF_LOGGING 1 -#define UIP_CONF_BUFFER_SIZE 116 - -#define UIP_CONF_TCP_FORWARD 1 - -#endif /* CONTIKI_CONF_H__ */ diff --git a/liteeth/software/libuip/liteethmac-drv.c b/liteeth/software/libuip/liteethmac-drv.c deleted file mode 100644 index d7d2535..0000000 --- a/liteeth/software/libuip/liteethmac-drv.c +++ /dev/null @@ -1,95 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// License: BSD - -#include "net/ip/uip.h" -#include "net/ip/uipopt.h" -#include "liteethmac-drv.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define ETHMAC_RX0_BASE ETHMAC_BASE -#define ETHMAC_RX1_BASE (ETHMAC_BASE+0x0800) -#define ETHMAC_TX0_BASE (ETHMAC_BASE+0x1000) -#define ETHMAC_TX1_BASE (ETHMAC_BASE+0x1800) - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -typedef union { - unsigned char raw[1514]; -} ethernet_buffer; - -static unsigned int rxslot; -static unsigned int rxlen; -static ethernet_buffer *rxbuffer; -static ethernet_buffer *rxbuffer0; -static ethernet_buffer *rxbuffer1; -static unsigned int txslot; -static unsigned int txlen; -static ethernet_buffer *txbuffer; -static ethernet_buffer *txbuffer0; -static ethernet_buffer *txbuffer1; - -void liteethmac_init(void) -{ - ethmac_sram_reader_ev_pending_write(ETHMAC_EV_SRAM_READER); - ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER); - - rxbuffer0 = (ethernet_buffer *)ETHMAC_RX0_BASE; - rxbuffer1 = (ethernet_buffer *)ETHMAC_RX1_BASE; - txbuffer0 = (ethernet_buffer *)ETHMAC_TX0_BASE; - txbuffer1 = (ethernet_buffer *)ETHMAC_TX1_BASE; - - rxslot = 0; - txslot = 0; - - rxbuffer = rxbuffer0; - txbuffer = txbuffer0; -} - -uint16_t liteethmac_poll(void) -{ - if(ethmac_sram_writer_ev_pending_read() & ETHMAC_EV_SRAM_WRITER) { - rxslot = ethmac_sram_writer_slot_read(); - rxlen = ethmac_sram_writer_length_read(); - if (rxslot) - rxbuffer = rxbuffer1; - else - rxbuffer = rxbuffer0; - memcpy(uip_buf, rxbuffer, rxlen); - uip_len = rxlen; - ethmac_sram_writer_ev_pending_write(ETHMAC_EV_SRAM_WRITER); - return rxlen; - } - return 0; -} - -void liteethmac_send(void) -{ - txlen = uip_len; - memset(txbuffer, 0, 60); - txlen = MIN(txlen, 1514); - memcpy(txbuffer, uip_buf, txlen); - txlen = MAX(txlen, 60); - ethmac_sram_reader_slot_write(txslot); - ethmac_sram_reader_length_write(txlen); - while(!(ethmac_sram_reader_ready_read())); - ethmac_sram_reader_start_write(1); - - txslot = (txslot+1)%2; - if (txslot) - txbuffer = txbuffer1; - else - txbuffer = txbuffer0; -} - -void liteethmac_exit(void) -{ -} diff --git a/liteeth/software/libuip/liteethmac-drv.h b/liteeth/software/libuip/liteethmac-drv.h deleted file mode 100644 index 973cf0a..0000000 --- a/liteeth/software/libuip/liteethmac-drv.h +++ /dev/null @@ -1,11 +0,0 @@ -// This file is Copyright (c) 2015 Florent Kermarrec -// License: BSD -#ifndef __LITEETHMAC_H__ -#define __LITEETHMAC_H__ - -void liteethmac_init(void); -uint16_t liteethmac_poll(void); -void liteethmac_send(void); -void liteethmac_exit(void); - -#endif /* __LITEETHMAC_H__ */ diff --git a/liteeth/software/libuip/rtimer-arch.c b/liteeth/software/libuip/rtimer-arch.c deleted file mode 100644 index f91ecf0..0000000 --- a/liteeth/software/libuip/rtimer-arch.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "contiki.h" - -#include -#include - -#include - -#define RTIMER_DEBUG - -void rtimer_callback(void) -{ -#ifdef RTIMER_DEBUG - printf("XXX rtimer_callback"); -#endif - rtimer_run_next(); -} - -void rtimer_arch_init(void) -{ -#ifdef RTIMER_DEBUG - printf("XXX rtimer_arch_init"); -#endif -} - -rtimer_clock_t rtimer_arch_now(void) -{ -#ifdef RTIMER_DEBUG - printf("XXX rtimer_arch_now"); -#endif - return 0; -} - -void rtimer_arch_schedule(rtimer_clock_t t) -{ -#ifdef RTIMER_DEBUG - printf("XXX rtimer_arch_schedule"); -#endif -} diff --git a/liteeth/software/libuip/rtimer-arch.h b/liteeth/software/libuip/rtimer-arch.h deleted file mode 100644 index fd4cf25..0000000 --- a/liteeth/software/libuip/rtimer-arch.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef RTIMER_ARCH_H_ -#define RTIMER_ARCH_H_ - -#include "contiki-conf.h" - -#include - -void rtimer_callback(void); -void rtimer_arch_init(void); -rtimer_clock_t rtimer_arch_now(void); -void rtimer_arch_schedule(rtimer_clock_t t); -#define RTIMER_ARCH_SECOND 312500 - -#endif - -/** @} */