From 8400c8e42e3644eec40ec85703cedabae6fd986e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 2 Dec 2009 20:13:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1371 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F103-GCC/halconf.h | 2 +- demos/MSP430-MSP430x1611-GCC/Makefile | 12 +++---- demos/MSP430-MSP430x1611-GCC/board.c | 64 ++++++++--------------------------- demos/MSP430-MSP430x1611-GCC/board.h | 2 -- demos/MSP430-MSP430x1611-GCC/main.c | 9 ++--- os/hal/platforms/MSP430/pal_lld.c | 4 +-- os/hal/platforms/MSP430/pal_lld.h | 2 ++ os/hal/platforms/MSP430/serial_lld.c | 6 ++-- os/hal/platforms/STM32/hal_lld.c | 2 +- os/hal/platforms/STM32/hal_lld.h | 4 +-- os/hal/templates/hal_lld.c | 4 +-- 11 files changed, 34 insertions(+), 77 deletions(-) diff --git a/demos/ARMCM3-STM32F103-GCC/halconf.h b/demos/ARMCM3-STM32F103-GCC/halconf.h index 44aae2773..2faba92d8 100644 --- a/demos/ARMCM3-STM32F103-GCC/halconf.h +++ b/demos/ARMCM3-STM32F103-GCC/halconf.h @@ -45,7 +45,7 @@ * @brief Enables the CAN subsystem. */ #if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) -#define CH_HAL_USE_CAN TRUE +#define CH_HAL_USE_CAN FALSE #endif /** diff --git a/demos/MSP430-MSP430x1611-GCC/Makefile b/demos/MSP430-MSP430x1611-GCC/Makefile index 7a7a720a8..97de20466 100644 --- a/demos/MSP430-MSP430x1611-GCC/Makefile +++ b/demos/MSP430-MSP430x1611-GCC/Makefile @@ -40,6 +40,8 @@ LDSCRIPT = mspgcc/msp430x1611.x # Imported source files CHIBIOS = ../.. +include ${CHIBIOS}/os/hal/hal.mk +include ${CHIBIOS}/os/hal/platforms/MSP430/platform.mk include ${CHIBIOS}/os/ports/GCC/MSP430/port.mk include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/test/test.mk @@ -48,10 +50,8 @@ include ${CHIBIOS}/test/test.mk CSRC = ${PORTSRC} \ ${KERNSRC} \ ${TESTSRC} \ - ${CHIBIOS}/os/io/pal.c \ - ${CHIBIOS}/os/io/serial.c \ - ${CHIBIOS}/os/io/platforms/MSP430/pal_lld.c \ - ${CHIBIOS}/os/io/platforms/MSP430/serial_lld.c \ + ${HALSRC} \ + ${PLATFORMSRC} \ ${CHIBIOS}/os/various/evtimer.c \ board.c main.c @@ -61,9 +61,7 @@ CPPSRC = # List ASM source files here ASMSRC = $(PORTASM) -INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ - ${CHIBIOS}/os/io \ - ${CHIBIOS}/os/io/platforms/MSP430 \ +INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \ ${CHIBIOS}/os/various # diff --git a/demos/MSP430-MSP430x1611-GCC/board.c b/demos/MSP430-MSP430x1611-GCC/board.c index 32f7c325b..93197bcfd 100644 --- a/demos/MSP430-MSP430x1611-GCC/board.c +++ b/demos/MSP430-MSP430x1611-GCC/board.c @@ -17,26 +17,21 @@ along with this program. If not, see . */ -#include -#include -#include - #include -#include "board.h" +#include "ch.h" +#include "hal.h" -/* - * Digital I/O ports static configuration as defined in @p board.h. - */ -static const MSP430DIOConfig config = -{ - {VAL_P1OUT, VAL_P1DIR}, - {VAL_P2OUT, VAL_P2DIR}, - {VAL_P3OUT, VAL_P3DIR}, - {VAL_P4OUT, VAL_P4DIR}, - {VAL_P5OUT, VAL_P5DIR}, - {VAL_P6OUT, VAL_P6DIR}, -}; +CH_IRQ_HANDLER(TIMERA0_VECTOR) { + + CH_IRQ_PROLOGUE(); + + chSysLockFromIsr(); + chSysTimerHandlerI(); + chSysUnlockFromIsr(); + + CH_IRQ_EPILOGUE(); +} /* * Hardware initialization goes here. @@ -45,24 +40,9 @@ static const MSP430DIOConfig config = void hwinit(void) { /* - * Clock sources setup. - */ - DCOCTL = VAL_DCOCTL; - BCSCTL1 = VAL_BCSCTL1; -#if defined(MSP_USE_XT2CLK) - do { - int i; - IFG1 &= ~OFIFG; - for (i = 255; i > 0; i--) - asm("nop"); - } while (IFG1 & OFIFG); -#endif - BCSCTL2 = VAL_BCSCTL2; - - /* - * I/O ports initialization. + * HAL initialization. */ - palInit(&config); + halInit(); /* * Timer 0 setup, uses SMCLK as source. @@ -71,20 +51,4 @@ void hwinit(void) { TACTL = TACLR; /* Clean start. */ TACTL = TASSEL_2 | ID_2 | MC_1; /* Src=SMCLK, ID=4, cmp=TACCR0. */ TACCTL0 = CCIE; /* Interrupt on compare. */ - - /* - * Other subsystems. - */ - sdInit(); -} - -CH_IRQ_HANDLER(TIMERA0_VECTOR) { - - CH_IRQ_PROLOGUE(); - - chSysLockFromIsr(); - chSysTimerHandlerI(); - chSysUnlockFromIsr(); - - CH_IRQ_EPILOGUE(); } diff --git a/demos/MSP430-MSP430x1611-GCC/board.h b/demos/MSP430-MSP430x1611-GCC/board.h index 235a8303a..836603f80 100644 --- a/demos/MSP430-MSP430x1611-GCC/board.h +++ b/demos/MSP430-MSP430x1611-GCC/board.h @@ -20,8 +20,6 @@ #ifndef _BOARD_H_ #define _BOARD_H_ -#include - /* * Clock settings. */ diff --git a/demos/MSP430-MSP430x1611-GCC/main.c b/demos/MSP430-MSP430x1611-GCC/main.c index 3e729296b..91fb26f83 100644 --- a/demos/MSP430-MSP430x1611-GCC/main.c +++ b/demos/MSP430-MSP430x1611-GCC/main.c @@ -17,12 +17,9 @@ along with this program. If not, see . */ -#include -#include -#include -#include - -#include "board.h" +#include "ch.h" +#include "hal.h" +#include "test.h" /* * Red LEDs blinker thread, times are in milliseconds. diff --git a/os/hal/platforms/MSP430/pal_lld.c b/os/hal/platforms/MSP430/pal_lld.c index 227853a12..0cd56de6e 100644 --- a/os/hal/platforms/MSP430/pal_lld.c +++ b/os/hal/platforms/MSP430/pal_lld.c @@ -24,8 +24,8 @@ * @{ */ -#include -#include +#include "ch.h" +#include "hal.h" /** * @brief MSP430 I/O ports configuration. diff --git a/os/hal/platforms/MSP430/pal_lld.h b/os/hal/platforms/MSP430/pal_lld.h index 4fbde7a40..0519af3b1 100644 --- a/os/hal/platforms/MSP430/pal_lld.h +++ b/os/hal/platforms/MSP430/pal_lld.h @@ -277,6 +277,8 @@ typedef union __ioport * ioportid_t; #define pal_lld_setgroupmode(port, mask, mode) \ _pal_lld_setgroupmode(port, mask, mode) +extern const MSP430DIOConfig pal_default_config; + #ifdef __cplusplus extern "C" { #endif diff --git a/os/hal/platforms/MSP430/serial_lld.c b/os/hal/platforms/MSP430/serial_lld.c index 4130432cd..e28bb3cd3 100644 --- a/os/hal/platforms/MSP430/serial_lld.c +++ b/os/hal/platforms/MSP430/serial_lld.c @@ -24,12 +24,10 @@ * @{ */ -#include -#include - #include -#include "board.h" +#include "ch.h" +#include "hal.h" #if USE_MSP430_USART0 || defined(__DOXYGEN__) /** @brief USART0 serial driver identifier.*/ diff --git a/os/hal/platforms/STM32/hal_lld.c b/os/hal/platforms/STM32/hal_lld.c index a904cf69f..d25b0f026 100644 --- a/os/hal/platforms/STM32/hal_lld.c +++ b/os/hal/platforms/STM32/hal_lld.c @@ -19,7 +19,7 @@ /** * @file STM32/hal_lld.c - * @brief STM32 HAL subsystem low level driver source + * @brief STM32 HAL subsystem low level driver source. * @addtogroup STM32_HAL * @{ */ diff --git a/os/hal/platforms/STM32/hal_lld.h b/os/hal/platforms/STM32/hal_lld.h index b0bba29d5..a6fdc9661 100644 --- a/os/hal/platforms/STM32/hal_lld.h +++ b/os/hal/platforms/STM32/hal_lld.h @@ -19,7 +19,7 @@ /** * @file STM32/hal_lld.h - * @brief STM32 HAL subsystem low level driver header + * @brief STM32 HAL subsystem low level driver header. * @addtogroup STM32_HAL * @{ */ @@ -33,7 +33,7 @@ */ #undef FALSE #undef TRUE -#include +#include "stm32f10x.h" #define FALSE 0 #define TRUE (!FALSE) diff --git a/os/hal/templates/hal_lld.c b/os/hal/templates/hal_lld.c index 0d2d46dcc..103645b38 100644 --- a/os/hal/templates/hal_lld.c +++ b/os/hal/templates/hal_lld.c @@ -24,8 +24,8 @@ * @{ */ -#include -#include +#include "ch.h" +#include "hal.h" /*===========================================================================*/ /* Low Level Driver exported variables. */ -- cgit v1.2.3