git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1359 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
2e33e2772a
commit
6dfa752b3e
|
@ -44,6 +44,8 @@ LDSCRIPT= ch.ld
|
||||||
|
|
||||||
# Imported source files
|
# Imported source files
|
||||||
CHIBIOS = ../..
|
CHIBIOS = ../..
|
||||||
|
include ${CHIBIOS}/os/hal/hal.mk
|
||||||
|
include ${CHIBIOS}/os/hal/platforms/AT91SAM7/platform.mk
|
||||||
include ${CHIBIOS}/os/ports/GCC/ARM7/port.mk
|
include ${CHIBIOS}/os/ports/GCC/ARM7/port.mk
|
||||||
include ${CHIBIOS}/os/kernel/kernel.mk
|
include ${CHIBIOS}/os/kernel/kernel.mk
|
||||||
include ${CHIBIOS}/test/test.mk
|
include ${CHIBIOS}/test/test.mk
|
||||||
|
@ -62,16 +64,9 @@ USRC = ${CHIBIOS}/ext/uip-1.0/uip/uip_arp.c \
|
||||||
CSRC = ${PORTSRC} \
|
CSRC = ${PORTSRC} \
|
||||||
${KERNSRC} \
|
${KERNSRC} \
|
||||||
${TESTSRC} \
|
${TESTSRC} \
|
||||||
|
${HALSRC} \
|
||||||
|
${PLATFORMSRC} \
|
||||||
${USRC} \
|
${USRC} \
|
||||||
${CHIBIOS}/os/io/pal.c \
|
|
||||||
${CHIBIOS}/os/io/serial.c \
|
|
||||||
${CHIBIOS}/os/io/mii.c \
|
|
||||||
${CHIBIOS}/os/io/mac.c \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7/pal_lld.c \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7/serial_lld.c \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7/mii_lld.c \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7/mac_lld.c \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7/at91lib/aic.c \
|
|
||||||
${CHIBIOS}/os/various/syscalls.c \
|
${CHIBIOS}/os/various/syscalls.c \
|
||||||
${CHIBIOS}/os/various/evtimer.c \
|
${CHIBIOS}/os/various/evtimer.c \
|
||||||
web/webthread.c \
|
web/webthread.c \
|
||||||
|
@ -106,9 +101,7 @@ TCPPSRC =
|
||||||
ASMSRC = $(PORTASM) \
|
ASMSRC = $(PORTASM) \
|
||||||
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7/vectors.s
|
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7/vectors.s
|
||||||
|
|
||||||
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) $(LWINC) \
|
||||||
${CHIBIOS}/os/io \
|
|
||||||
${CHIBIOS}/os/io/platforms/AT91SAM7 \
|
|
||||||
${CHIBIOS}/os/various \
|
${CHIBIOS}/os/various \
|
||||||
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7 \
|
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7 \
|
||||||
./web ${CHIBIOS}/ext/uip-1.0/uip ${CHIBIOS}/ext/uip-1.0/apps/webserver
|
./web ${CHIBIOS}/ext/uip-1.0/uip ${CHIBIOS}/ext/uip-1.0/apps/webserver
|
||||||
|
|
|
@ -17,28 +17,8 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <pal.h>
|
#include "hal.h"
|
||||||
#include <serial.h>
|
|
||||||
#include <mac.h>
|
|
||||||
|
|
||||||
#include "board.h"
|
|
||||||
#include "at91lib/aic.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* FIQ Handler weak symbol defined in vectors.s.
|
|
||||||
*/
|
|
||||||
void FiqHandler(void);
|
|
||||||
|
|
||||||
static CH_IRQ_HANDLER(SpuriousHandler) {
|
|
||||||
|
|
||||||
CH_IRQ_PROLOGUE();
|
|
||||||
|
|
||||||
AT91C_BASE_AIC->AIC_EOICR = 0;
|
|
||||||
|
|
||||||
CH_IRQ_EPILOGUE();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SYS IRQ handling here.
|
* SYS IRQ handling here.
|
||||||
|
@ -58,61 +38,14 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
|
||||||
CH_IRQ_EPILOGUE();
|
CH_IRQ_EPILOGUE();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Digital I/O ports static configuration as defined in @p board.h.
|
|
||||||
*/
|
|
||||||
static const AT91SAM7PIOConfig config =
|
|
||||||
{
|
|
||||||
{VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
|
|
||||||
#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
|
|
||||||
{VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Early initialization code.
|
* Early initialization code.
|
||||||
* This initialization is performed just after reset before BSS and DATA
|
* This initialization is performed just after reset before BSS and DATA
|
||||||
* segments initialization.
|
* segments initialization.
|
||||||
*/
|
*/
|
||||||
void hwinit0(void) {
|
void hwinit0(void) {
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
/*
|
at91sam7_clock_init();
|
||||||
* Watchdog disabled.
|
|
||||||
*/
|
|
||||||
AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS))
|
|
||||||
;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PLL setup: DIV = 14, MUL = 72, PLLCOUNT = 10
|
|
||||||
* PLLfreq = 96109714 Hz (rounded)
|
|
||||||
*/
|
|
||||||
AT91C_BASE_PMC->PMC_PLLR = (AT91C_CKGR_DIV & 14) |
|
|
||||||
(AT91C_CKGR_PLLCOUNT & (10 << 8)) |
|
|
||||||
(AT91C_CKGR_MUL & (72 << 16));
|
|
||||||
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK))
|
|
||||||
;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Master clock = PLLfreq / 2 = 48054858 Hz (rounded)
|
|
||||||
*/
|
|
||||||
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_PLL_CLK | AT91C_PMC_PRES_CLK_2;
|
|
||||||
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY))
|
|
||||||
;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PIO initialization.
|
|
||||||
*/
|
|
||||||
palInit(&config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -121,19 +54,11 @@ void hwinit0(void) {
|
||||||
* and before invoking the main() function.
|
* and before invoking the main() function.
|
||||||
*/
|
*/
|
||||||
void hwinit1(void) {
|
void hwinit1(void) {
|
||||||
int i;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default AIC setup, the device drivers will modify it as needed.
|
* HAL initialization.
|
||||||
*/
|
*/
|
||||||
AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF;
|
halInit();
|
||||||
AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF;
|
|
||||||
AT91C_BASE_AIC->AIC_SVR[0] = (AT91_REG)FiqHandler;
|
|
||||||
for (i = 1; i < 31; i++) {
|
|
||||||
AT91C_BASE_AIC->AIC_SVR[i] = (AT91_REG)NULL;
|
|
||||||
AT91C_BASE_AIC->AIC_EOICR = (AT91_REG)i;
|
|
||||||
}
|
|
||||||
AT91C_BASE_AIC->AIC_SPU = (AT91_REG)SpuriousHandler;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LCD pins setup.
|
* LCD pins setup.
|
||||||
|
@ -171,18 +96,12 @@ void hwinit1(void) {
|
||||||
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
|
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Serial driver initialization, RTS/CTS pins enabled for USART0 only.
|
* RTS/CTS pins enabled for USART0 only.
|
||||||
*/
|
*/
|
||||||
sdInit();
|
|
||||||
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_RTS0 | AT91C_PA4_CTS0;
|
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_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
|
||||||
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
|
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
|
||||||
|
|
||||||
/*
|
|
||||||
* EMAC driver initialization.
|
|
||||||
*/
|
|
||||||
macInit();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ChibiOS/RT initialization.
|
* ChibiOS/RT initialization.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,12 +17,9 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <pal.h>
|
#include "hal.h"
|
||||||
#include <test.h>
|
#include "test.h"
|
||||||
#include <serial.h>
|
|
||||||
|
|
||||||
#include "board.h"
|
|
||||||
|
|
||||||
#include "web/webthread.h"
|
#include "web/webthread.h"
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <ch.h>
|
#include "ch.h"
|
||||||
#include <evtimer.h>
|
#include "hal.h"
|
||||||
#include <mac.h>
|
#include "evtimer.h"
|
||||||
|
|
||||||
#include <uip.h>
|
#include "uip.h"
|
||||||
#include <uip_arp.h>
|
#include "uip_arp.h"
|
||||||
#include <httpd.h>
|
#include "httpd.h"
|
||||||
#include <clock-arch.h>
|
#include "clock-arch.h"
|
||||||
|
|
||||||
#define IPADDR0 192
|
#define IPADDR0 192
|
||||||
#define IPADDR1 168
|
#define IPADDR1 168
|
||||||
|
|
Loading…
Reference in New Issue