From a76aedd0eb7994a7b2658a42ba45f22643118561 Mon Sep 17 00:00:00 2001 From: lottaviano Date: Tue, 24 May 2011 13:41:15 +0000 Subject: [PATCH] Update sam3x tcp server example to the latest Ethernet changes. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4922 38d2e660-2303-0410-9eaa-f027e97ec537 --- .../sam3x-ek_tcp_server/cfg/cfg_dac.h | 30 +++++++++++++ .../sam3x-ek_tcp_server/cfg/cfg_lwip.h | 7 +++ .../sam3x-ek_tcp_server/cfg/cfg_proc.h | 6 +++ .../sam3x-ek_tcp_server/project.bertos | 28 ++++++------ .../sam3x-ek_tcp_server.mk | 11 ++--- boards/sam3x-ek/hw/hw_eth.c | 40 +++++++++++++++++ boards/sam3x-ek/hw/hw_eth.h | 44 +++++++++++++++++++ 7 files changed, 147 insertions(+), 19 deletions(-) create mode 100644 boards/sam3x-ek/hw/hw_eth.c create mode 100644 boards/sam3x-ek/hw/hw_eth.h diff --git a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_dac.h b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_dac.h index 8eff7bc3..1ae1e984 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_dac.h +++ b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_dac.h @@ -55,4 +55,34 @@ */ #define DAC_LOG_FORMAT LOG_FMT_TERSE +/** + * DAC Refresh Period = 1024*REFRESH/DACC Clock + * + * $WIZ$ type = "int" + * $WIZ$ supports = "sam3x" + * $WIZ$ min = 0 + * $WIZ$ max = 65536 + */ +#define CONFIG_DAC_REFRESH 16 + +/** + * DAC Startup Time Selection. + * see datasheet table. + * + * $WIZ$ type = "int" + * $WIZ$ supports = "sam3x" + * $WIZ$ min = 0 + * $WIZ$ max = 63 + */ +#define CONFIG_DAC_STARTUP 0 + +/** + * DAC Trigger Selection. + * + * $WIZ$ type = "enum" + * $WIZ$ value_list = "sam3x_dac_tc" + * $WIZ$ supports = "sam3x" + */ +#define CONFIG_DAC_TIMER DACC_TRGSEL_TIO_CH0 + #endif /* CFG_DAC_H */ diff --git a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_lwip.h b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_lwip.h index b6b55f65..73acb913 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_lwip.h +++ b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_lwip.h @@ -1206,6 +1206,13 @@ * $WIZ$ type = "boolean" */ #define LWIP_SOCKET 1 +#if LWIP_SOCKET + /* + * The sockets.c file requires this macro to be defined to really + * set errno on errors. + */ + #define ERRNO +#endif /** * Enable BSD-style sockets functions names. diff --git a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_proc.h b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_proc.h index 382e0d4e..22816a6b 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_proc.h +++ b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/cfg/cfg_proc.h @@ -74,6 +74,12 @@ */ #define CONFIG_KERN_PRI 0 +/** + * Priority-inheritance protocol. + * $WIZ$ type = "boolean" + */ +#define CONFIG_KERN_PRI_INHERIT 0 + /** * Dynamic memory allocation for processes. * $WIZ$ type = "boolean" diff --git a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/project.bertos b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/project.bertos index d157a404..e0729cbb 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/project.bertos +++ b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/project.bertos @@ -21,32 +21,32 @@ S'path' p10 Varm-none-eabi-gcc p11 -ssS'PROJECT_SRC_PATH_FROM_MAKEFILE' +ssS'PROJECT_HW_PATH_FROM_MAKEFILE' p12 -Vboards/sam3x-ek/examples/sam3x-ek_tcp_server +Vboards/sam3x-ek p13 sS'ENABLED_MODULES' p14 (lp15 -S'signal' +S'debug' p16 -aS'kernel' +aS'eth' p17 -aS'monitor' +aS'formatwr' p18 -aS'debug' +aS'heap' p19 -aS'timer' +aS'kernel' p20 -aS'formatwr' +aS'lwip' p21 -aS'msg' +aS'monitor' p22 -aS'heap' +aS'msg' p23 -aS'eth' +aS'signal' p24 -aS'lwip' +aS'timer' p25 asS'CPU_NAME' p26 @@ -63,9 +63,9 @@ p31 sS'PRESET' p32 I01 -sS'PROJECT_HW_PATH_FROM_MAKEFILE' +sS'PROJECT_SRC_PATH_FROM_MAKEFILE' p33 -Vboards/sam3x-ek +Vboards/sam3x-ek/examples/sam3x-ek_tcp_server p34 sS'OUTPUT' p35 diff --git a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/sam3x-ek_tcp_server.mk b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/sam3x-ek_tcp_server.mk index ed22aa99..4e155053 100644 --- a/boards/sam3x-ek/examples/sam3x-ek_tcp_server/sam3x-ek_tcp_server.mk +++ b/boards/sam3x-ek/examples/sam3x-ek_tcp_server/sam3x-ek_tcp_server.mk @@ -19,18 +19,19 @@ sam3x-ek_tcp_server_HW_PATH = boards/sam3x-ek # Files automatically generated by the wizard. DO NOT EDIT, USE sam3x-ek_tcp_server_USER_CSRC INSTEAD! sam3x-ek_tcp_server_WIZARD_CSRC = \ - bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c \ - bertos/mware/event.c \ bertos/cpu/cortex-m3/drv/eth_sam3.c \ bertos/cpu/cortex-m3/drv/timer_cm3.c \ - bertos/struct/heap.c \ - bertos/kern/monitor.c \ + bertos/cpu/cortex-m3/hw/switch_ctx_cm3.c \ bertos/drv/timer.c \ - bertos/kern/signal.c \ + bertos/kern/monitor.c \ bertos/kern/proc.c \ + bertos/kern/signal.c \ + bertos/mware/event.c \ bertos/mware/formatwr.c \ bertos/mware/hex.c \ bertos/net/lwip.c \ + bertos/struct/heap.c \ + $(sam3x-ek_tcp_server_HW_PATH)/hw/hw_eth.c \ # # Files automatically generated by the wizard. DO NOT EDIT, USE sam3x-ek_tcp_server_USER_PCSRC INSTEAD! diff --git a/boards/sam3x-ek/hw/hw_eth.c b/boards/sam3x-ek/hw/hw_eth.c new file mode 100644 index 00000000..93697327 --- /dev/null +++ b/boards/sam3x-ek/hw/hw_eth.c @@ -0,0 +1,40 @@ +/** + * \file + * + * + * \brief MAC address definition + * + * \author Luca Ottaviano + */ + +#include "hw/hw_eth.h" + +uint8_t mac_addr[] = { 0x00, 0x12, 0x22, 0x32, 0x44, 0x55 }; diff --git a/boards/sam3x-ek/hw/hw_eth.h b/boards/sam3x-ek/hw/hw_eth.h new file mode 100644 index 00000000..71c2ac89 --- /dev/null +++ b/boards/sam3x-ek/hw/hw_eth.h @@ -0,0 +1,44 @@ +/** + * \file + * + * + * \brief MAC address definition + * + * \author Luca Ottaviano + */ +#ifndef HW_ETH_H +#define HW_ETH_H + +#include + +extern uint8_t mac_addr[6]; + +#endif // HW_ETH_H -- 2.25.1