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

master
gdisirio 2008-10-04 10:03:33 +00:00
parent b7affa79a1
commit 983920ddc9
3 changed files with 19 additions and 10 deletions

View File

@ -41,7 +41,6 @@ static msg_t Thread1(void *arg) {
*/ */
int main(int argc, char **argv) { int main(int argc, char **argv) {
/* /*
* Creates the blinker thread. * Creates the blinker thread.
*/ */

View File

@ -55,11 +55,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) { void hwinit0(void) {
int i;
/* /*
* Flash Memory: 1 wait state, about 50 cycles in a microsecond. * Flash Memory: 1 wait state, about 50 cycles in a microsecond.
*/ */
@ -100,6 +100,15 @@ void hwinit(void) {
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB); AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_PIOA) | (1 << AT91C_ID_PIOB);
AT91C_BASE_PIOA->PIO_PER = 0xFFFFFFFF; AT91C_BASE_PIOA->PIO_PER = 0xFFFFFFFF;
AT91C_BASE_PIOB->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. * Default AIC setup, the device drivers will modify it as needed.

View File

@ -41,19 +41,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) { int main(int argc, char **argv) {
/* /*
* The main() function becomes a thread here then the interrupts are * Creates the blinker and web server threads.
* enabled and ChibiOS/RT goes live.
*/ */
chSysInit();
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
chThdCreateStatic(waWebThread, sizeof(waWebThread), NORMALPRIO - 1, WebThread, NULL); chThdCreateStatic(waWebThread, sizeof(waWebThread), NORMALPRIO - 1, WebThread, NULL);
/*
* Normal main() thread activity.
*/
while (TRUE) { while (TRUE) {
chThdSleep(500); chThdSleep(500);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1)) if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1))