git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@455 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2008-10-04 09:59:39 +00:00
parent 88d9fc3ce9
commit b7affa79a1
2 changed files with 26 additions and 10 deletions

View File

@ -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();
}

View File

@ -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.
*/
chSysInit();
/*
* Creates the blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity.
*/
while (TRUE) {
chThdSleep(500);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1))