From 69d687d05d42ba501c5aa1a6b26a2a7f46954612 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 18 Jan 2009 16:30:31 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@635 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- ports/ARMCM3/chcore.h | 12 ++++++-- ports/MSP430/chcore.c | 14 ++++++--- ports/MSP430/chcore.h | 67 ++++++++++++++++++++++++++----------------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h index 4ac271c79..85dcd0044 100644 --- a/ports/ARMCM3/chcore.h +++ b/ports/ARMCM3/chcore.h @@ -29,12 +29,16 @@ * Port-related configuration parameters. */ -/** Enables the use of the WFI ins. */ +/** + * Enables the use of the WFI ins. + */ #ifndef ENABLE_WFI_IDLE #define ENABLE_WFI_IDLE 0 #endif -/** BASEPRI user level, 0 = disabled. */ +/** + * BASEPRI user level, 0 = disabled. + */ #ifndef BASEPRI_USER #define BASEPRI_USER 0 #endif @@ -59,7 +63,9 @@ #define PRIORITY_SVCALL (BASEPRI_KERNEL - 0x10) #endif -/** SYSTICK handler priority. */ +/** + * SYSTICK handler priority. + */ #ifndef PRIORITY_SYSTICK #define PRIORITY_SYSTICK 0x80 #endif diff --git a/ports/MSP430/chcore.c b/ports/MSP430/chcore.c index e56f41120..cea8d22ed 100644 --- a/ports/MSP430/chcore.c +++ b/ports/MSP430/chcore.c @@ -38,8 +38,10 @@ * it in your application code. * @param msg pointer to the message string */ +/** @cond never */ __attribute__((weak)) -void sys_puts(char *msg) { +/** @endcond */ +void port_puts(char *msg) { } /** @@ -49,8 +51,10 @@ void sys_puts(char *msg) { * @note The function is declared as a weak symbol, it is possible to redefine * it in your application code. */ +/** @cond never */ __attribute__((naked, weak)) -void sys_switch(Thread *otp, Thread *ntp) { +/** @endcond */ +void port_switch(Thread *otp, Thread *ntp) { register struct intctx *sp asm("r1"); asm volatile ("push r11 \n\t" \ @@ -79,10 +83,12 @@ void sys_switch(Thread *otp, Thread *ntp) { * @note The function is declared as a weak symbol, it is possible to redefine * it in your application code. */ +/** @cond never */ __attribute__((weak)) -void sys_halt(void) { +/** @endcond */ +void port_halt(void) { - sys_disable(); + port_disable(); while (TRUE) { } } diff --git a/ports/MSP430/chcore.h b/ports/MSP430/chcore.h index 807e7168f..642e53286 100644 --- a/ports/MSP430/chcore.h +++ b/ports/MSP430/chcore.h @@ -139,68 +139,81 @@ typedef struct { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_PROLOGUE() +#define PORT_IRQ_PROLOGUE() /** * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_EPILOGUE() { \ -if (chSchRescRequiredI()) \ - chSchDoRescheduleI(); \ +#define PORT_IRQ_EPILOGUE() { \ + if (chSchRescRequiredI()) \ + chSchDoRescheduleI(); \ } /** * IRQ handler function modifier. Note, it just aliases the WinMSP "interrupt" * macro. */ -#define SYS_IRQ_HANDLER interrupt - -/** - * This port function is implemented as inlined code for performance reasons. - */ -#define sys_disable() asm volatile ("dint") - -/** - * This port function is implemented as inlined code for performance reasons. - */ -#define sys_enable() asm volatile ("eint") +#define PORT_IRQ_HANDLER interrupt /** * This function is empty in this port. */ -#define sys_disable_from_isr() +#define port_init() + +/** + * Implemented as global interrupt disable. + */ +#define port_lock() asm volatile ("dint") + +/** + * Implemented as global interrupt enable. + */ +#define port_unlock() asm volatile ("eint") /** * This function is empty in this port. */ -#define sys_enable_from_isr() +#define port_lock_from_isr() /** - * Disables all the interrupt sources, even those having a priority higher - * to the kernel. - * In this port it is no different than sys_disable() because the simple - * interrupt handling + * This function is empty in this port. */ -#define sys_disable_all() sys_disable() +#define port_unlock_from_isr() + +/** + * Implemented as global interrupt disable. + */ +#define port_disable() asm volatile ("dint") + +/** + * Same as @p port_disable() in this port, there is no difference between the + * two states. + */ +#define port_suspend() asm volatile ("dint") + +/** + * Implemented as global interrupt enable. + */ +#define port_enable() asm volatile ("eint") /** * This port function is implemented as inlined code for performance reasons. */ #if ENABLE_WFI_IDLE != 0 -#define sys_wait_for_interrupt() { \ +#define port_wait_for_interrupt() { \ asm volatile ("wfi"); \ } #else -#define sys_wait_for_interrupt() +#define port_wait_for_interrupt() #endif #ifdef __cplusplus extern "C" { #endif - void sys_puts(char *msg); - void sys_switch(Thread *otp, Thread *ntp); - void sys_halt(void); + void port_puts(char *msg); + void port_switch(Thread *otp, Thread *ntp); + void port_halt(void); void threadstart(void); #ifdef __cplusplus }