diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-10-03 19:24:16 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-10-03 19:24:16 +0000 |
commit | cbf137ed955b30d8695d881aa8d16f1a723b89b5 (patch) | |
tree | ead8a7783643bb326b1158394c63a3a818104980 /demos | |
parent | fdf3ac2d0ab45974c5671cbfb5b6da2188087862 (diff) | |
download | ChibiOS-cbf137ed955b30d8695d881aa8d16f1a723b89b5.tar.gz ChibiOS-cbf137ed955b30d8695d881aa8d16f1a723b89b5.tar.bz2 ChibiOS-cbf137ed955b30d8695d881aa8d16f1a723b89b5.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1203 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile | 2 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h | 5 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c | 12 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c | 5 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.h | 5 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/lwipopts.h | 2 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-LWIP-GCC/main.c | 11 |
7 files changed, 29 insertions, 13 deletions
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile b/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile index e38c35681..80127d948 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile @@ -5,7 +5,7 @@ # Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu
+ USE_OPT = -O0 -ggdb -fomit-frame-pointer -mabi=apcs-gnu
endif
# C++ specific options here (added to USE_OPT).
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h b/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h index 21ad75bde..e6a58ce12 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/chconf.h @@ -339,7 +339,8 @@ #define THREAD_EXT_FIELDS \
struct { \
/* Add thread custom fields here.*/ \
- void *p_timeouts; \
+ /* Space for the LWIP sys_timeouts structure.*/ \
+ void *p_lwipspace[1]; \
};
#endif
@@ -350,7 +351,7 @@ struct { \ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__)
#define THREAD_EXT_INIT(tp) { \
/* Add thread initialization code here.*/ \
- currp->p_timeouts = NULL; \
+ (tp)->p_lwipspace[0] = NULL; \
}
#endif
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c index df3a97738..329e0f8de 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c @@ -66,14 +66,14 @@ void sys_init(void) { sys_sem_t sys_sem_new(u8_t count) {
- sys_sem_t sem = mem_malloc(sizeof(Semaphore));
+ sys_sem_t sem = chHeapAlloc(sizeof(Semaphore));
chSemInit(sem, (cnt_t)count);
return sem;
}
void sys_sem_free(sys_sem_t sem) {
- mem_free(sem);
+ chHeapFree(sem);
}
void sys_sem_signal(sys_sem_t sem) {
@@ -97,14 +97,14 @@ u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout) { sys_mbox_t sys_mbox_new(int size) {
sys_mbox_t mbox;
- mbox = mem_malloc(sizeof(Mailbox) + sizeof(msg_t) * size);
+ mbox = chHeapAlloc(sizeof(Mailbox) + sizeof(msg_t) * size);
chMBInit(mbox, (void *)(mbox + 1), size);
return mbox;
}
void sys_mbox_free(sys_mbox_t mbox) {
- mem_free(mbox);
+ chHeapFree(mbox);
}
void sys_mbox_post(sys_mbox_t mbox, void *msg) {
@@ -141,13 +141,13 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg) { struct sys_timeouts *sys_arch_timeouts(void) {
- return (struct sys_timeouts *)&currp->p_timeouts;
+ return (struct sys_timeouts *)currp->p_lwipspace;
}
sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg),
void *arg, int stacksize, int prio) {
size_t wsz = THD_WA_SIZE(stacksize);
- void *wsp = mem_malloc(wsz);
+ void *wsp = chHeapAlloc(wsz);
if (wsp == NULL)
return NULL;
return (sys_thread_t)chThdCreateStatic(wsp, wsz, prio, (tfunc_t)thread, arg);
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c index 2f4869d36..7b9d483c4 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c @@ -79,6 +79,11 @@ #define PERIODIC_TIMER_ID 1
#define FRAME_RECEIVED_ID 2
+/**
+ * Stack area for the LWIP-MAC thread. + */
+WORKING_AREA(wa_lwip_thread, LWIP_THREAD_STACK_SIZE);
+
/*
* Initialization. */
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.h b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.h index 0e0fd9031..85969bede 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.h +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.h @@ -44,7 +44,7 @@ /** @brief MAC thread stack size. */
#if !defined(LWIP_THREAD_STACK_SIZE) || defined(__DOXYGEN__)
-#define LWIP_THREAD_STACK_SIZE 256
+#define LWIP_THREAD_STACK_SIZE 512
#endif
/** @brief Transmission timeout. */
@@ -97,9 +97,12 @@ #define LWIP_IFNAME1 's'
#endif
+extern WORKING_AREA(wa_lwip_thread, LWIP_THREAD_STACK_SIZE);
+
#ifdef __cplusplus
extern "C" {
#endif
+ msg_t lwip_thread(void *p);
#ifdef __cplusplus
}
#endif
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwipopts.h b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwipopts.h index 28f7c6fd2..318ee6579 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwipopts.h +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwipopts.h @@ -1010,7 +1010,7 @@ * sys_thread_new() when the thread is created.
*/
#ifndef TCPIP_THREAD_PRIO
-#define TCPIP_THREAD_PRIO (LOWPRIO)
+#define TCPIP_THREAD_PRIO (LOWPRIO + 1)
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c index f6c297a41..098e764a5 100644 --- a/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c @@ -23,15 +23,16 @@ #include <test.h>
#include "board.h"
+#include "lwipthread.h"
static WORKING_AREA(waThread1, 64);
static msg_t Thread1(void *arg) {
while (TRUE) {
- palSetPad(IOPORT2, PIOB_LCD_BL);
- chThdSleepMilliseconds(100);
palClearPad(IOPORT2, PIOB_LCD_BL);
chThdSleepMilliseconds(900);
+ palSetPad(IOPORT2, PIOB_LCD_BL);
+ chThdSleepMilliseconds(100);
}
return 0;
}
@@ -53,6 +54,12 @@ int main(int argc, char **argv) { chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
+ * Creates the LWIP threads. + */
+ chThdCreateStatic(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, LOWPRIO,
+ lwip_thread, NULL);
+
+ /*
* Normal main() thread activity.
*/
while (TRUE) {
|