From 2b5e0544c8285976d94abe21268342698c94dd85 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Jul 2009 15:33:21 +0000 Subject: Completed PAL support for LPC214x. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1056 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-LPC214x-G++/Makefile | 1 + demos/ARM7-LPC214x-G++/board.c | 21 +++++++++++++-------- demos/ARM7-LPC214x-G++/board.h | 4 ++-- demos/ARM7-LPC214x-GCC-minimal/board.c | 7 ------- demos/ARM7-LPC214x-GCC-minimal/board.h | 6 ++---- demos/ARM7-LPC214x-GCC/Makefile | 1 + demos/ARM7-LPC214x-GCC/board.c | 21 +++++++++++++-------- demos/ARM7-LPC214x-GCC/board.h | 4 ++-- 8 files changed, 34 insertions(+), 31 deletions(-) (limited to 'demos') diff --git a/demos/ARM7-LPC214x-G++/Makefile b/demos/ARM7-LPC214x-G++/Makefile index 24a8ce684..894a37e61 100644 --- a/demos/ARM7-LPC214x-G++/Makefile +++ b/demos/ARM7-LPC214x-G++/Makefile @@ -50,6 +50,7 @@ include ../../test/test.mk # setting. CSRC = ../../ports/ARM7/chcore.c \ ../../ports/ARM7-LPC214x/vic.c \ + ../../ports/ARM7-LPC214x/pal_lld.c \ ../../ports/ARM7-LPC214x/lpc214x_serial.c \ ${KERNSRC} \ ${TESTSRC} \ diff --git a/demos/ARM7-LPC214x-G++/board.c b/demos/ARM7-LPC214x-G++/board.c index c3c39a5a9..68b060dbd 100644 --- a/demos/ARM7-LPC214x-G++/board.c +++ b/demos/ARM7-LPC214x-G++/board.c @@ -58,6 +58,18 @@ static CH_IRQ_HANDLER(T0IrqHandler) { CH_IRQ_EPILOGUE(); } +/* + * Digital I/O ports static configuration as defined in @p board.h. + */ +static const LPC214xFIOConfig config = +{ + VAL_PINSEL0, + VAL_PINSEL1, + VAL_PINSEL2, + {VAL_FIO0PIN, VAL_FIO0DIR}, + {VAL_FIO1PIN, VAL_FIO1DIR} +}; + /* * Early initialization code. * This initialization is performed just after reset before BSS and DATA @@ -101,14 +113,7 @@ void hwinit0(void) { /* * I/O pins configuration. */ - PINSEL0 = VAL_PINSEL0; - PINSEL1 = VAL_PINSEL1; - PINSEL2 = VAL_PINSEL2; - palInit(); - pal_lld_lpc214x_set_direction(IOPORT_A, VAL_FIO0DIR); - palWritePort(IOPORT_A, 0xFFFFFFFF); - pal_lld_lpc214x_set_direction(IOPORT_B, VAL_FIO1DIR); - palWritePort(IOPORT_B, 0xFFFFFFFF); + palInit(&config); } /* diff --git a/demos/ARM7-LPC214x-G++/board.h b/demos/ARM7-LPC214x-G++/board.h index fee4baa61..022383032 100644 --- a/demos/ARM7-LPC214x-G++/board.h +++ b/demos/ARM7-LPC214x-G++/board.h @@ -20,9 +20,7 @@ #ifndef _BOARD_H_ #define _BOARD_H_ -#ifndef _LPC214X_H_ #include "lpc214x.h" -#endif #define BOARD_OLIMEX_LCP_P2148 @@ -64,6 +62,8 @@ #define VAL_PINSEL2 0x00000004 #define VAL_FIO0DIR 0xB0703C00 #define VAL_FIO1DIR 0x00000000 +#define VAL_FIO0PIN 0xFFFFFFFF +#define VAL_FIO1PIN 0xFFFFFFFF #define PA_LED1 10 #define PA_LED2 11 diff --git a/demos/ARM7-LPC214x-GCC-minimal/board.c b/demos/ARM7-LPC214x-GCC-minimal/board.c index 980626ab5..95732cfef 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/board.c +++ b/demos/ARM7-LPC214x-GCC-minimal/board.c @@ -113,14 +113,7 @@ void hwinit0(void) { /* * I/O pins configuration. */ -// PINSEL0 = VAL_PINSEL0; -// PINSEL1 = VAL_PINSEL1; -// PINSEL2 = VAL_PINSEL2; palInit(&config); -// pal_lld_lpc214x_set_direction(IOPORT_A, VAL_FIO0DIR); -// palWritePort(IOPORT_A, 0xFFFFFFFF); -// pal_lld_lpc214x_set_direction(IOPORT_B, VAL_FIO1DIR); -// palWritePort(IOPORT_B, 0xFFFFFFFF); } /* diff --git a/demos/ARM7-LPC214x-GCC-minimal/board.h b/demos/ARM7-LPC214x-GCC-minimal/board.h index ab4aa76f6..022383032 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/board.h +++ b/demos/ARM7-LPC214x-GCC-minimal/board.h @@ -20,9 +20,7 @@ #ifndef _BOARD_H_ #define _BOARD_H_ -#ifndef _LPC214X_H_ #include "lpc214x.h" -#endif #define BOARD_OLIMEX_LCP_P2148 @@ -64,8 +62,8 @@ #define VAL_PINSEL2 0x00000004 #define VAL_FIO0DIR 0xB0703C00 #define VAL_FIO1DIR 0x00000000 -#define VAL_FIO0PIN 0x00000000 -#define VAL_FIO1PIN 0x00000000 +#define VAL_FIO0PIN 0xFFFFFFFF +#define VAL_FIO1PIN 0xFFFFFFFF #define PA_LED1 10 #define PA_LED2 11 diff --git a/demos/ARM7-LPC214x-GCC/Makefile b/demos/ARM7-LPC214x-GCC/Makefile index c7bf868ef..2185bbe94 100644 --- a/demos/ARM7-LPC214x-GCC/Makefile +++ b/demos/ARM7-LPC214x-GCC/Makefile @@ -50,6 +50,7 @@ include ../../test/test.mk # setting. CSRC = ../../ports/ARM7/chcore.c \ ../../ports/ARM7-LPC214x/vic.c \ + ../../ports/ARM7-LPC214x/pal_lld.c \ ../../ports/ARM7-LPC214x/lpc214x_serial.c \ ../../ports/ARM7-LPC214x/lpc214x_ssp.c \ ${KERNSRC} \ diff --git a/demos/ARM7-LPC214x-GCC/board.c b/demos/ARM7-LPC214x-GCC/board.c index 9eec8b06d..8be258a1a 100644 --- a/demos/ARM7-LPC214x-GCC/board.c +++ b/demos/ARM7-LPC214x-GCC/board.c @@ -58,6 +58,18 @@ static CH_IRQ_HANDLER(T0IrqHandler) { CH_IRQ_EPILOGUE(); } +/* + * Digital I/O ports static configuration as defined in @p board.h. + */ +static const LPC214xFIOConfig config = +{ + VAL_PINSEL0, + VAL_PINSEL1, + VAL_PINSEL2, + {VAL_FIO0PIN, VAL_FIO0DIR}, + {VAL_FIO1PIN, VAL_FIO1DIR} +}; + /* * Early initialization code. * This initialization is performed just after reset before BSS and DATA @@ -101,14 +113,7 @@ void hwinit0(void) { /* * I/O pins configuration. */ - PINSEL0 = VAL_PINSEL0; - PINSEL1 = VAL_PINSEL1; - PINSEL2 = VAL_PINSEL2; - palInit(); - pal_lld_lpc214x_set_direction(IOPORT_A, VAL_FIO0DIR); - palWritePort(IOPORT_A, 0xFFFFFFFF); - pal_lld_lpc214x_set_direction(IOPORT_B, VAL_FIO1DIR); - palWritePort(IOPORT_B, 0xFFFFFFFF); + palInit(&config); } /* diff --git a/demos/ARM7-LPC214x-GCC/board.h b/demos/ARM7-LPC214x-GCC/board.h index fee4baa61..022383032 100644 --- a/demos/ARM7-LPC214x-GCC/board.h +++ b/demos/ARM7-LPC214x-GCC/board.h @@ -20,9 +20,7 @@ #ifndef _BOARD_H_ #define _BOARD_H_ -#ifndef _LPC214X_H_ #include "lpc214x.h" -#endif #define BOARD_OLIMEX_LCP_P2148 @@ -64,6 +62,8 @@ #define VAL_PINSEL2 0x00000004 #define VAL_FIO0DIR 0xB0703C00 #define VAL_FIO1DIR 0x00000000 +#define VAL_FIO0PIN 0xFFFFFFFF +#define VAL_FIO1PIN 0xFFFFFFFF #define PA_LED1 10 #define PA_LED2 11 -- cgit v1.2.3