From 69809928d30e617299b42b6626955d82c28719c0 Mon Sep 17 00:00:00 2001 From: Martin Lenders Date: Thu, 19 Dec 2013 16:48:31 +0100 Subject: [PATCH] Make UART0_BUFSIZE configurable by CPU --- boards/msba2-common/drivers/include/uart0.h | 2 -- cpu/lpc2387/include/cpu-conf.h | 5 +++++ cpu/mc1322x/include/cpu-conf.h | 4 ++++ cpu/msp430-common/include/cpu-conf.h | 4 ++++ cpu/native/include/cpu-conf.h | 5 +++++ sys/include/board_uart0.h | 2 ++ sys/uart0/uart0.c | 6 +++++- 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/boards/msba2-common/drivers/include/uart0.h b/boards/msba2-common/drivers/include/uart0.h index b0861b2b1..9ed716a1d 100644 --- a/boards/msba2-common/drivers/include/uart0.h +++ b/boards/msba2-common/drivers/include/uart0.h @@ -1,8 +1,6 @@ #ifndef __UART0_H #define __UART0_H -#define UART0_BUFSIZE 32 - extern int uart0_handler_pid; #endif /* __UART0_H */ diff --git a/cpu/lpc2387/include/cpu-conf.h b/cpu/lpc2387/include/cpu-conf.h index 43ea15a52..afe924cf3 100644 --- a/cpu/lpc2387/include/cpu-conf.h +++ b/cpu/lpc2387/include/cpu-conf.h @@ -75,5 +75,10 @@ See the file LICENSE in the top level directory for more details. #define TRANSCEIVER_BUFFER_SIZE (10) #define RX_BUF_SIZE (10) +#ifndef UART0_BUFSIZE +#define UART0_BUFSIZE (128) +#endif + + /** @} */ #endif /* CPUCONF_H_ */ diff --git a/cpu/mc1322x/include/cpu-conf.h b/cpu/mc1322x/include/cpu-conf.h index b1c6f5210..57121f114 100644 --- a/cpu/mc1322x/include/cpu-conf.h +++ b/cpu/mc1322x/include/cpu-conf.h @@ -59,5 +59,9 @@ #define TRANSCEIVER_BUFFER_SIZE (10) #define RX_BUF_SIZE (10) +#ifndef UART0_BUFSIZE +#define UART0_BUFSIZE (64) +#endif + /** @} */ #endif /* CPUCONF_H_ */ diff --git a/cpu/msp430-common/include/cpu-conf.h b/cpu/msp430-common/include/cpu-conf.h index 198223a76..4ffa783b6 100644 --- a/cpu/msp430-common/include/cpu-conf.h +++ b/cpu/msp430-common/include/cpu-conf.h @@ -28,6 +28,10 @@ See the file LICENSE in the top level directory for more details. #define RX_BUF_SIZE (3) #define TRANSCEIVER_BUFFER_SIZE (3) + +#ifndef UART0_BUFSIZE +#define UART0_BUFSIZE (32) +#endif /** @} */ #endif /* CPUCONF_H_ */ diff --git a/cpu/native/include/cpu-conf.h b/cpu/native/include/cpu-conf.h index c9153275d..4ddd47a91 100644 --- a/cpu/native/include/cpu-conf.h +++ b/cpu/native/include/cpu-conf.h @@ -48,6 +48,11 @@ #define NATIVE_ISR_STACKSIZE (8192) #endif /* OS */ +#ifdef UART0_BUFSIZE +#undef UART0_BUFSIZE +#endif +#define UART0_BUFSIZE (128) + /* for nativenet */ #define NATIVE_ETH_PROTO 0x1234 diff --git a/sys/include/board_uart0.h b/sys/include/board_uart0.h index 734950da0..e7af70bd5 100644 --- a/sys/include/board_uart0.h +++ b/sys/include/board_uart0.h @@ -12,6 +12,8 @@ #ifndef __BOARD_UART0_H #define __BOARD_UART0_H +#include "cpu-conf.h" /* To give user access to UART0_BUFSIZE */ + extern int uart0_handler_pid; void board_uart0_init(void); diff --git a/sys/uart0/uart0.c b/sys/uart0/uart0.c index 5153f408d..2dac1b1c7 100644 --- a/sys/uart0/uart0.c +++ b/sys/uart0/uart0.c @@ -1,5 +1,6 @@ #include +#include "cpu-conf.h" #include "chardev_thread.h" #include "ringbuffer.h" #include "thread.h" @@ -9,7 +10,10 @@ #include "board_uart0.h" -#define UART0_BUFSIZE (32) +#ifndef UART0_BUFSIZE +#define UART0_BUFSIZE (128) +#endif + #define UART0_STACKSIZE (MINIMUM_STACK_SIZE + 256) ringbuffer_t uart0_ringbuffer;