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

This commit is contained in:
gdisirio 2009-11-30 19:11:03 +00:00
parent 39d171f7ef
commit 770c4873d2
6 changed files with 27 additions and 13 deletions

View File

@ -44,7 +44,10 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
* segments initialization. * segments initialization.
*/ */
void hwinit0(void) { void hwinit0(void) {
/* Watchdog disabled.*/
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
at91sam7_clock_init(); at91sam7_clock_init();
} }
@ -56,7 +59,7 @@ void hwinit0(void) {
void hwinit1(void) { void hwinit1(void) {
/* /*
* HAL initialization. * HAL initialization.
*/ */
halInit(); halInit();

View File

@ -44,7 +44,10 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
* segments initialization. * segments initialization.
*/ */
void hwinit0(void) { void hwinit0(void) {
/* Watchdog disabled.*/
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
at91sam7_clock_init(); at91sam7_clock_init();
} }
@ -56,7 +59,7 @@ void hwinit0(void) {
void hwinit1(void) { void hwinit1(void) {
/* /*
* HAL initialization. * HAL initialization.
*/ */
halInit(); halInit();

View File

@ -21,8 +21,8 @@
#include "hal.h" #include "hal.h"
#include "test.h" #include "test.h"
#include "lwip\lwipthread.h" #include "lwip/lwipthread.h"
#include "web\web.h" #include "web/web.h"
static WORKING_AREA(waThread1, 64); static WORKING_AREA(waThread1, 64);
static msg_t Thread1(void *arg) { static msg_t Thread1(void *arg) {
@ -57,13 +57,13 @@ int main(int argc, char **argv) {
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/* /*
* Creates the LWIP threads (it changes priority internally). * Creates the LWIP threads (it changes priority internally).
*/ */
chThdCreateStatic(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, NORMALPRIO + 1, chThdCreateStatic(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, NORMALPRIO + 1,
lwip_thread, NULL); lwip_thread, NULL);
/* /*
* Creates the HTTP thread (it changes priority internally). * Creates the HTTP thread (it changes priority internally).
*/ */
chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1, chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1,
http_server, NULL); http_server, NULL);

View File

@ -45,6 +45,9 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
*/ */
void hwinit0(void) { void hwinit0(void) {
/* Watchdog disabled.*/
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
at91sam7_clock_init(); at91sam7_clock_init();
} }
@ -56,7 +59,7 @@ void hwinit0(void) {
void hwinit1(void) { void hwinit1(void) {
/* /*
* HAL initialization. * HAL initialization.
*/ */
halInit(); halInit();

View File

@ -100,9 +100,6 @@ void at91sam7_clock_init(void) {
/* Flash Memory: 1 wait state, about 50 cycles in a microsecond.*/ /* Flash Memory: 1 wait state, about 50 cycles in a microsecond.*/
AT91C_BASE_MC->MC_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS; AT91C_BASE_MC->MC_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS;
/* Watchdog disabled.*/
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
/* Enables the main oscillator and waits 56 slow cycles as startup time.*/ /* Enables the main oscillator and waits 56 slow cycles as startup time.*/
AT91C_BASE_PMC->PMC_MOR = (AT91C_CKGR_OSCOUNT & (7 << 8)) | AT91C_CKGR_MOSCEN; AT91C_BASE_PMC->PMC_MOR = (AT91C_CKGR_OSCOUNT & (7 << 8)) | AT91C_CKGR_MOSCEN;
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS)) while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS))
@ -112,6 +109,7 @@ void at91sam7_clock_init(void) {
PLLfreq = 96109714 Hz (rounded).*/ PLLfreq = 96109714 Hz (rounded).*/
AT91C_BASE_PMC->PMC_PLLR = (AT91C_CKGR_DIV & 14) | AT91C_BASE_PMC->PMC_PLLR = (AT91C_CKGR_DIV & 14) |
(AT91C_CKGR_PLLCOUNT & (10 << 8)) | (AT91C_CKGR_PLLCOUNT & (10 << 8)) |
(AT91SAM7_USBDIV) |
(AT91C_CKGR_MUL & (72 << 16)); (AT91C_CKGR_MUL & (72 << 16));
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK)) while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK))
; ;

View File

@ -35,12 +35,19 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Default action for the spurious handler, nothing. * @brief Default action for the spurious handler, nothing.
*/ */
#if !defined(AT91SAM7_SPURIOUS_HANDLER_HOOK) || defined(__DOXYGEN__) #if !defined(AT91SAM7_SPURIOUS_HANDLER_HOOK) || defined(__DOXYGEN__)
#define AT91SAM7_SPURIOUS_HANDLER_HOOK() #define AT91SAM7_SPURIOUS_HANDLER_HOOK()
#endif #endif
/**
* @brief Default divider for the USB clock - half the PLL clock.
*/
#if !defined(AT91SAM7_USBDIV) || defined(__DOXYGEN__)
#define AT91SAM7_USBDIV AT91C_CKGR_USBDIV_1
#endif
/*===========================================================================*/ /*===========================================================================*/
/* Driver constants. */ /* Driver constants. */
/*===========================================================================*/ /*===========================================================================*/