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

This commit is contained in:
gdisirio 2008-02-19 15:34:41 +00:00
parent 53b6f6d8df
commit dcd80dadf3
7 changed files with 32 additions and 12 deletions

View File

@ -62,7 +62,7 @@ UDEFS =
UADEFS =
# List ARM-mode C source files here
ASRC = ../../ports/ARM7-LPC214x/GCC/chcore.c \
ASRC = ../../ports/ARM7-AT91SAM7X/GCC/chcore.c \
../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \
../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \
../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \

View File

@ -31,7 +31,7 @@ static void SpuriousHandler(void) {
}
/*
* Timer 0 IRQ handling here.
* SYS IRQ handling here.
*/
__attribute__((naked))
static void SYSIrqHandler(void) {
@ -39,6 +39,7 @@ static void SYSIrqHandler(void) {
chSysIRQEnterI();
if (AT91C_BASE_PITC->PITC_PISR & AT91C_PITC_PITS) {
// AT91C_BASE_PIOB->PIO_SODR = PIOB_LCD_BL; // LCD on.
chSysTimerHandlerI();
(void) AT91C_BASE_PITC->PITC_PIVR;
}
@ -46,6 +47,9 @@ static void SYSIrqHandler(void) {
chSysIRQExitI();
}
/*
* Board initialization code.
*/
void hwinit(void) {
int i;
@ -104,7 +108,7 @@ void hwinit(void) {
/*
* LCD pins setup.
*/
AT91C_BASE_PIOB->PIO_SODR = PIOB_LCD_BL; // Set to high.
AT91C_BASE_PIOB->PIO_CODR = PIOB_LCD_BL; // Set to low.
AT91C_BASE_PIOB->PIO_OER = PIOB_LCD_BL; // Configure as output.
AT91C_BASE_SYS->PIOA_PPUDR = PIOB_LCD_BL; // Disable internal pullup resistor.
@ -126,7 +130,10 @@ void hwinit(void) {
/*
* PIT Initialization.
*/
AIC_ConfigureIT(AT91C_ID_SYS, AT91C_AIC_SRCTYPE_POSITIVE_EDGE, SYSIrqHandler);
AIC_ConfigureIT(AT91C_ID_SYS,
AT91C_AIC_SRCTYPE_POSITIVE_EDGE | (AT91C_AIC_PRIOR_HIGHEST -1),
SYSIrqHandler);
AIC_EnableIT(AT91C_ID_SYS);
AT91C_BASE_PITC->PITC_PIMR = (MCK / 16 / CH_FREQUENCY) - 1;
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
}

View File

@ -26,7 +26,8 @@
#define BOARD_OLIMEX_SAM7_EX256
#define MCK 18432000
#define CLK 18432000
#define MCK 48054857
/*
* I/O definitions.

View File

@ -37,9 +37,6 @@ MEMORY
__ram_start__ = ORIGIN(ram);
__ram_size__ = LENGTH(ram);
__ram_end__ = __ram_start__ + __ram_size__;
__dma_start__ = 0x7FD00000;
__dma_size__ = 8k;
__dma_end__ = 0x7FD00000 + __dma_size__;
SECTIONS
{

View File

@ -19,7 +19,19 @@
#include <ch.h>
#include "at91lib/AT91SAM7X256.h"
#include "board.h"
static WorkingArea(waThread1, 64);
static t_msg Thread1(void *arg) {
while (TRUE) {
AT91C_BASE_PIOB->PIO_SODR = PIOB_LCD_BL; // LCD on.
chThdSleep(500);
AT91C_BASE_PIOB->PIO_CODR = PIOB_LCD_BL; // LCD off.
chThdSleep(500);
}
return 0;
}
/*
* Entry point, the interrupts are disabled on entry.
@ -32,8 +44,11 @@ int main(int argc, char **argv) {
*/
chSysInit();
while (TRUE)
chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
while (TRUE) {
chThdSleep(1000);
}
return 0;
}

View File

@ -138,7 +138,7 @@ __attribute__((naked, weak))
void IrqCommon(void) {
register BOOL b asm("r0");
// VICVectAddr = 0;
AT91C_BASE_AIC->AIC_EOICR = (AT91_REG)AT91C_BASE_AIC;
b = chSchRescRequiredI();
#ifdef THUMB
asm(".p2align 2,, \n\t" \

View File

@ -18,7 +18,7 @@
*/
/*
* Generic ARM startup file for ChibiOS/RT.
* Generic ARM startup file for ChibiOS/RT (Atmel variant).
*/
.extern _main