From 9f6887fdd7c0abe03144f29d9585ee71c645c8dc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 6 Jan 2009 09:32:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@588 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F103-GCC/chconf.h | 9 +++++++++ ports/ARMCM3-STM32F103/stm32_serial.c | 12 ++++++------ ports/ARMCM3/chcore.h | 9 +++++---- readme.txt | 2 ++ src/chsys.c | 2 +- src/include/sys.h | 2 +- src/templates/chcore.h | 6 +++--- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h index ed950dd3f..e329d0bdd 100644 --- a/demos/ARMCM3-STM32F103-GCC/chconf.h +++ b/demos/ARMCM3-STM32F103-GCC/chconf.h @@ -30,6 +30,15 @@ * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED +/** Configuration option: If enabled then the used of nested @p chSysLock() / + * @p chSysUnlock() operations is allowed.
+ * For performance and code size reasons the recommended setting is leave + * this option disabled.
+ * You can use this option if you need to merge with ChibiOS/RT external + * libraries that require nested lock/unlock operations. + */ +//#define CH_USE_NESTED_LOCKS + /** Configuration option: if specified then the kernel performs the round * robin scheduling algorithm on threads of equal priority. */ #define CH_USE_ROUNDROBIN diff --git a/ports/ARMCM3-STM32F103/stm32_serial.c b/ports/ARMCM3-STM32F103/stm32_serial.c index fbb1775c9..de8cedf98 100644 --- a/ports/ARMCM3-STM32F103/stm32_serial.c +++ b/ports/ARMCM3-STM32F103/stm32_serial.c @@ -55,9 +55,9 @@ static void SetError(uint16_t sr, FullDuplexDriver *com) { sts |= SD_FRAMING_ERROR; if (sr & SR_LBD) sts |= SD_BREAK_DETECTED; - chSysLock(); + chSysLockI(); chFDDAddFlagsI(com, sts); - chSysUnlock(); + chSysUnlockI(); } static void ServeInterrupt(USART_TypeDef *u, FullDuplexDriver *com) { @@ -66,14 +66,14 @@ static void ServeInterrupt(USART_TypeDef *u, FullDuplexDriver *com) { if (sr & (SR_ORE | SR_FE | SR_PE | SR_LBD)) SetError(sr, com); if (sr & SR_RXNE) { - chSysLock(); + chSysLockI(); chFDDIncomingDataI(com, u->DR); - chSysUnlock(); + chSysUnlockI(); } if (sr & SR_TXE) { - chSysLock(); + chSysLockI(); msg_t b = chFDDRequestDataI(com); - chSysUnlock(); + chSysUnlockI(); if (b < Q_OK) u->CR1 &= ~CR1_TXEIE; else diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h index cdd4a0625..36ee1f93b 100644 --- a/ports/ARMCM3/chcore.h +++ b/ports/ARMCM3/chcore.h @@ -135,10 +135,10 @@ typedef struct { /** * Computes the thread working area global size. */ -#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ + sizeof(struct intctx) + \ + sizeof(struct extctx) + \ + (n) + (INT_REQUIRED_STACK)) /** * Macro used to allocate a thread working area aligned as both position and @@ -209,6 +209,7 @@ extern "C" { #endif void sys_puts(char *msg); void sys_halt(void); + void threadstart(void); #ifdef __cplusplus } #endif diff --git a/readme.txt b/readme.txt index de00b5a75..a2b7ace52 100644 --- a/readme.txt +++ b/readme.txt @@ -85,6 +85,8 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, *** 1.0.0rc2 *** - FIX: Removed unused variable "retaddr" from the Cortex-M3 port. +- FIX: The macro THD_WA_SIZE was defined wrongly in the file + ./src/templates/chcore.h. *** 1.0.0rc1 *** - NEW: Added new macros CH_KERNEL_VERSION set to "1.0.0rc1", CH_KERNEL_MAJOR diff --git a/src/chsys.c b/src/chsys.c index 0f5f7fa39..21fbe1048 100644 --- a/src/chsys.c +++ b/src/chsys.c @@ -71,7 +71,7 @@ void chSysInit(void) { * serve interrupts in its context while keeping the lowest energy saving * mode compatible with the system status. */ - chThdCreateStatic(idle_wa, sizeof(idle_thread_wa), IDLEPRIO, + chThdCreateStatic(idle_thread_wa, sizeof(idle_thread_wa), IDLEPRIO, (tfunc_t)idle_thread, NULL); } diff --git a/src/include/sys.h b/src/include/sys.h index 7cc94ce82..6c6b65704 100644 --- a/src/include/sys.h +++ b/src/include/sys.h @@ -153,7 +153,7 @@ */ #if defined(CH_OPTIMIZE_SPEED) #define chSysLock() chSysLockInline() -#define chSysUnlock chSysUnlockInline() +#define chSysUnlock() chSysUnlockInline() #endif /* defined(CH_OPTIMIZE_SPEED) */ #ifdef __cplusplus diff --git a/src/templates/chcore.h b/src/templates/chcore.h index 4e0aaf16a..f94cb4b18 100644 --- a/src/templates/chcore.h +++ b/src/templates/chcore.h @@ -98,9 +98,9 @@ typedef struct { /** * Computes the thread working area global size. */ -#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ + sizeof(struct intctx) + \ + sizeof(struct extctx) + \ (n) + (INT_REQUIRED_STACK)) /** -- cgit v1.2.3