diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-04 09:59:39 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-04 09:59:39 +0000 |
commit | b7affa79a14cc90a38b3e48c9393cd87710512b9 (patch) | |
tree | 1554dbf5822d1fa680d624e8e73525c5a63e4305 | |
parent | 88d9fc3ce959134051241fd261f9f56026248648 (diff) | |
download | ChibiOS-b7affa79a14cc90a38b3e48c9393cd87710512b9.tar.gz ChibiOS-b7affa79a14cc90a38b3e48c9393cd87710512b9.tar.bz2 ChibiOS-b7affa79a14cc90a38b3e48c9393cd87710512b9.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@455 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | demos/ARM7-AT91SAM7X-GCC/board.c | 22 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-GCC/main.c | 12 |
2 files changed, 25 insertions, 9 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/board.c b/demos/ARM7-AT91SAM7X-GCC/board.c index 4bc78f086..8a4b7c4ea 100644 --- a/demos/ARM7-AT91SAM7X-GCC/board.c +++ b/demos/ARM7-AT91SAM7X-GCC/board.c @@ -54,11 +54,11 @@ static void SYSIrqHandler(void) { }
/*
- * Board initialization code.
+ * Early initialization code.
+ * This initialization is performed just after reset before BSS and DATA
+ * segments initialization.
*/
-void hwinit(void) {
- int i;
-
+void hwinit0(void) {
/*
* Flash Memory: 1 wait state, about 50 cycles in a microsecond.
*/
@@ -99,6 +99,15 @@ void hwinit(void) { AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB);
AT91C_BASE_PIOA->PIO_PER = 0xFFFFFFFF;
AT91C_BASE_PIOB->PIO_PER = 0xFFFFFFFF;
+}
+
+/*
+ * Late initialization code.
+ * This initialization is performed after BSS and DATA segments initialization
+ * and before invoking the main() function.
+ */
+void hwinit1(void) {
+ int i;
/*
* Default AIC setup, the device drivers will modify it as needed.
@@ -150,4 +159,9 @@ void hwinit(void) { AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_RTS0 | AT91C_PA4_CTS0;
AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
+
+ /*
+ * ChibiOS/RT initialization.
+ */
+ chSysInit();
}
diff --git a/demos/ARM7-AT91SAM7X-GCC/main.c b/demos/ARM7-AT91SAM7X-GCC/main.c index abd84bd87..c280e5489 100644 --- a/demos/ARM7-AT91SAM7X-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-GCC/main.c @@ -36,18 +36,20 @@ static msg_t Thread1(void *arg) { }
/*
- * Entry point, the interrupts are disabled on entry.
+ * Entry point, note, the main() function is already a thread in the system
+ * on entry.
*/
int main(int argc, char **argv) {
+
/*
- * The main() function becomes a thread here then the interrupts are
- * enabled and ChibiOS/RT goes live.
+ * Creates the blinker thread.
*/
- chSysInit();
-
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+ /*
+ * Normal main() thread activity.
+ */
while (TRUE) {
chThdSleep(500);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1))
|