aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARM7-AT91SAM7X-GCC
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-07-11 14:36:20 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-07-11 14:36:20 +0000
commit43def70685c2b8cfc998a4a906d6b209aeb974ac (patch)
treeb36f52e65d8ff611bd00de8cda3c89bede2a0a4c /demos/ARM7-AT91SAM7X-GCC
parent2b5e0544c8285976d94abe21268342698c94dd85 (diff)
downloadChibiOS-43def70685c2b8cfc998a4a906d6b209aeb974ac.tar.gz
ChibiOS-43def70685c2b8cfc998a4a906d6b209aeb974ac.tar.bz2
ChibiOS-43def70685c2b8cfc998a4a906d6b209aeb974ac.zip
Completed PAL support for AT91SAM7X.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1057 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARM7-AT91SAM7X-GCC')
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/Makefile1
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/board.c33
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/board.h13
3 files changed, 34 insertions, 13 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/Makefile b/demos/ARM7-AT91SAM7X-GCC/Makefile
index 728167a6d..db19978c8 100644
--- a/demos/ARM7-AT91SAM7X-GCC/Makefile
+++ b/demos/ARM7-AT91SAM7X-GCC/Makefile
@@ -49,6 +49,7 @@ include ../../test/test.mk
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = ../../ports/ARM7/chcore.c \
+ ../../ports/ARM7-AT91SAM7X/pal_lld.c \
../../ports/ARM7-AT91SAM7X/sam7x_serial.c \
${KERNSRC} \
${TESTSRC} \
diff --git a/demos/ARM7-AT91SAM7X-GCC/board.c b/demos/ARM7-AT91SAM7X-GCC/board.c
index 02ac5046d..aac51cf0c 100644
--- a/demos/ARM7-AT91SAM7X-GCC/board.c
+++ b/demos/ARM7-AT91SAM7X-GCC/board.c
@@ -58,6 +58,15 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
}
/*
+ * Digital I/O ports static configuration as defined in @p board.h.
+ */
+static const AT91SAM7XPIOConfig config =
+{
+ {VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
+ {VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
+};
+
+/*
* Early initialization code.
* This initialization is performed just after reset before BSS and DATA
* segments initialization.
@@ -100,7 +109,7 @@ void hwinit0(void) {
/*
* PIO initialization.
*/
- palInit();
+ palInit(&config);
}
/*
@@ -126,24 +135,26 @@ void hwinit1(void) {
* LCD pins setup.
*/
palClearPad(IOPORT_B, PIOB_LCD_BL);
- AT91C_BASE_PIOB->PIO_OER = PIOB_LCD_BL_MASK; // Configure as output.
- AT91C_BASE_PIOB->PIO_PPUDR = PIOB_LCD_BL_MASK; // Disable internal pullup resistor.
+ palSetPadMode(IOPORT_B, PIOB_LCD_BL, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(IOPORT_A, PIOA_LCD_RESET);
- AT91C_BASE_PIOA->PIO_OER = PIOA_LCD_RESET_MASK; // Configure as output.
- AT91C_BASE_PIOA->PIO_PPUDR = PIOA_LCD_RESET_MASK; // Disable internal pullup resistor.
+ palSetPadMode(IOPORT_A, PIOA_LCD_RESET, PAL_MODE_OUTPUT_PUSHPULL);
/*
- * Joystick and buttons, disable pullups, already inputs.
+ * Joystick and buttons setup.
*/
- AT91C_BASE_PIOA->PIO_PPUDR = PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK |
- PIOA_B4_MASK | PIOA_B5_MASK;
- AT91C_BASE_PIOB->PIO_PPUDR = PIOB_SW1_MASK | PIOB_SW2_MASK;
+ palSetGroupMode(IOPORT_A,
+ PIOA_B1_MASK | PIOA_B2_MASK | PIOA_B3_MASK |
+ PIOA_B4_MASK | PIOA_B5_MASK,
+ PAL_MODE_INPUT);
+ palSetGroupMode(IOPORT_B, PIOB_SW1_MASK | PIOB_SW2_MASK, PAL_MODE_INPUT);
/*
- * MMC/SD slot, disable pullups, already inputs.
+ * MMC/SD slot setup.
*/
- AT91C_BASE_SYS->PIOB_PPUDR = PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK;
+ palSetGroupMode(IOPORT_B,
+ PIOB_MMC_WP_MASK | PIOB_MMC_CP_MASK,
+ PAL_MODE_INPUT);
/*
* PIT Initialization.
diff --git a/demos/ARM7-AT91SAM7X-GCC/board.h b/demos/ARM7-AT91SAM7X-GCC/board.h
index fe9219aa3..c56f50258 100644
--- a/demos/ARM7-AT91SAM7X-GCC/board.h
+++ b/demos/ARM7-AT91SAM7X-GCC/board.h
@@ -20,9 +20,7 @@
#ifndef _BOARD_H_
#define _BOARD_H_
-#ifndef AT91SAM7X256_H
#include "at91lib/AT91SAM7X256.h"
-#endif
#define BOARD_OLIMEX_SAM7_EX256
@@ -30,6 +28,17 @@
#define MCK 48054857
/*
+ * Initial I/O setup.
+ */
+#define VAL_PIOA_ODSR 0x00000000 /* Output data. */
+#define VAL_PIOA_OSR 0x00000000 /* Direction. */
+#define VAL_PIOA_PUSR 0xFFFFFFFF /* Pull-up. */
+
+#define VAL_PIOB_ODSR 0x00000000 /* Output data. */
+#define VAL_PIOB_OSR 0x00000000 /* Direction. */
+#define VAL_PIOB_PUSR 0xFFFFFFFF /* Pull-up. */
+
+/*
* I/O definitions.
*/
#define PIOA_LCD_RESET 2