Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
plumbum committed Mar 24, 2010
1 parent 95ee730 commit c487b73
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 262 deletions.
7 changes: 7 additions & 0 deletions Samples/ARM7/LPC2xxx/GCC4.x/1-EventFlag/Include/LPC2103.h
Expand Up @@ -34,6 +34,13 @@

#define END_OF_RAM 0x40002000

/* Interrupts num */
#define VIC_SW 1
#define VIC_TIMER0 4
#define VIC_TIMER1 5
#define VIC_TIMER2 26
#define VIC_TIMER3 27

#ifndef __ASSEMBLER__

#include "LPC2103bits.h"
Expand Down
3 changes: 0 additions & 3 deletions Samples/ARM7/LPC2xxx/GCC4.x/1-EventFlag/Include/device.h
Expand Up @@ -34,9 +34,6 @@ extern "C" void abort(void);
#define RTOS_TICK_RATE 1000 // Hz


#define VIC_SW 1
#define VIC_TIMER3 27


// some handy DEFINES
#ifndef FALSE
Expand Down
203 changes: 0 additions & 203 deletions Samples/ARM7/LPC2xxx/GCC4.x/1-EventFlag/Src/crt.s

This file was deleted.

Expand Up @@ -111,7 +111,7 @@ typedef word TTimeout;
// interrupt. See documentation fo details.
//
//
#define scmRTOS_CONTEXT_SWITCH_SCHEME 1
#define scmRTOS_CONTEXT_SWITCH_SCHEME 0

//-----------------------------------------------------------------------------
//
Expand Down
10 changes: 5 additions & 5 deletions Samples/ARM7/LPC2xxx/GCC4.x/1-EventFlag/Src/scmRTOS_TARGET_CFG.h
Expand Up @@ -60,13 +60,13 @@
//
// System Timer stuff
//
// TIMER3 used as System timer
// TIMER0 used as System timer
//
#define SYSTEM_TIMER_INT VIC_TIMER3
#define SYSTEM_TIMER_INT VIC_TIMER0

#define RESET_SYSTIMER_INT() do { T3IR = T3IR; } while(0)
#define LOCK_SYSTEM_TIMER() do { T3MCR &= ~TMCR_MR0_I; } while(0)
#define UNLOCK_SYSTEM_TIMER() do { T3MCR |= TMCR_MR0_I; } while(0)
#define RESET_SYSTIMER_INT() do { T0IR = T0IR; } while(0)
#define LOCK_SYSTEM_TIMER() do { T0MCR &= ~TMCR_MR0_I; } while(0)
#define UNLOCK_SYSTEM_TIMER() do { T0MCR |= TMCR_MR0_I; } while(0)

//-----------------------------------------------------------------------------

Expand Down
101 changes: 51 additions & 50 deletions Samples/ARM7/LPC2xxx/GCC4.x/1-EventFlag/Startup/system.cpp
Expand Up @@ -8,60 +8,71 @@ extern "C" void sysInit(void);
void sysInit(void)
{
// lowInit(); // setup clocks and processor port pins
// setup the parallel port pin
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
// setup the parallel port pin
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;

#if (USE_FIO == 1)
SCS |= 0x01; // Enable Fast GPIO
FIO0MASK = 0x00000000;
FIO0SET = 0x00000000; //Initialize pins to high level
FIO0CLR = 0xFFFFFFFF; //Initialize pins to low level
FIO0DIR = 0x00000000; //Set pin direction
SCS |= 0x01; // Enable Fast GPIO
FIO0MASK = 0x00000000;
FIO0SET = 0x00000000; //Initialize pins to high level
FIO0CLR = 0xFFFFFFFF; //Initialize pins to low level
FIO0DIR = 0x00000000; //Set pin direction
#else
IOSET = 0x00000000; //Initialize pins to high level
IOCLR = 0xFFFFFFFF; //Initialize pins to low level
IODIR = 0x00000000; //Set pin direction
IOSET = 0x00000000; //Initialize pins to high level
IOCLR = 0xFFFFFFFF; //Initialize pins to low level
IODIR = 0x00000000; //Set pin direction
#endif


// setup & enable the MAM
MAMTIM = MAMTIM_CYCLES;
MAMCR = MAMCR_FULL;
// setup & enable the MAM
MAMTIM = MAMTIM_CYCLES;
MAMCR = MAMCR_FULL;

// set the peripheral bus speed
// value computed from config.h
VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed
// set the peripheral bus speed
// value computed from config.h
VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed

// set the interrupt controller defaults
// set the interrupt controller defaults
#if defined(RAM_RUN)
MEMMAP = MEMMAP_SRAM; // map interrupt vectors space into SRAM
MEMMAP = MEMMAP_SRAM; // map interrupt vectors space into SRAM
#elif defined(ROM_RUN)
MEMMAP = MEMMAP_FLASH; // map interrupt vectors space into FLASH
MEMMAP = MEMMAP_FLASH; // map interrupt vectors space into FLASH
#else
#error RUN_MODE not defined!
#endif

VICIntEnClear = 0xFFFFFFFF; // clear all interrupts
VICIntSelect = 0x00000000; // clear all FIQ selections
VICDefVectAddr = (uint32_t)reset; // point unvectored IRQs to reset()

VICVectAddr0 = (unsigned int)0; /* Set the vector address */
VICVectAddr1 = (unsigned int)0; /* Set the vector address */
VICVectAddr2 = (unsigned int)0; /* Set the vector address */
VICVectAddr3 = (unsigned int)0; /* Set the vector address */
VICVectAddr4 = (unsigned int)0; /* Set the vector address */
VICVectAddr5 = (unsigned int)0; /* Set the vector address */
VICVectAddr6 = (unsigned int)0; /* Set the vector address */
VICVectAddr7 = (unsigned int)0; /* Set the vector address */
VICVectAddr8 = (unsigned int)0; /* Set the vector address */
VICVectAddr9 = (unsigned int)0; /* Set the vector address */
VICVectAddr10 = (unsigned int)0; /* Set the vector address */
VICVectAddr11 = (unsigned int)0; /* Set the vector address */
VICVectAddr12 = (unsigned int)0; /* Set the vector address */
VICVectAddr13 = (unsigned int)0; /* Set the vector address */
//VICVectAddr14 = (unsigned int)0; /* Set the vector address */
//VICVectAddr15 = (unsigned int)0; /* Set the vector address */
VICIntEnClear = 0xFFFFFFFF; // clear all interrupts
VICIntSelect = 0x00000000; // clear all FIQ selections
VICDefVectAddr = (uint32_t)reset; // point unvectored IRQs to reset()

VICVectAddr0 = (unsigned int)0; /* Set the vector address */
VICVectAddr1 = (unsigned int)0; /* Set the vector address */
VICVectAddr2 = (unsigned int)0; /* Set the vector address */
VICVectAddr3 = (unsigned int)0; /* Set the vector address */
VICVectAddr4 = (unsigned int)0; /* Set the vector address */
VICVectAddr5 = (unsigned int)0; /* Set the vector address */
VICVectAddr6 = (unsigned int)0; /* Set the vector address */
VICVectAddr7 = (unsigned int)0; /* Set the vector address */
VICVectAddr8 = (unsigned int)0; /* Set the vector address */
VICVectAddr9 = (unsigned int)0; /* Set the vector address */
VICVectAddr10 = (unsigned int)0; /* Set the vector address */
VICVectAddr11 = (unsigned int)0; /* Set the vector address */
VICVectAddr12 = (unsigned int)0; /* Set the vector address */
VICVectAddr13 = (unsigned int)0; /* Set the vector address */
VICVectAddr14 = (unsigned int)0; /* Set the vector address */
VICVectAddr15 = (unsigned int)0; /* Set the vector address */

// ***************************************************************************
// ** TIMER0
// ***************************************************************************
// RTOS system timer
T0IR = 0x000000FF; // clear int requests
T0TCR = (1<<1); // reset timer
T0PR = 0;
T0MR0 = PCLK / RTOS_TICK_RATE; // int at TICK_RATE
T0MCR = TMCR_MR0_I | TMCR_MR0_R;
T0TCR = (1<<0); // CE = 1, enable timer

// Set system timer interrupt vector with little bit higher priority than context switcher
VICVectAddr14 = (dword)OS::SystemTimer_ISR;
Expand All @@ -79,16 +90,6 @@ void sysInit(void)

VICVectAddr = 0; // Reset VIC logic

// ***************************************************************************
// ** TIMER3
// ***************************************************************************
// RTOS system timer
T3IR = 0x000000FF; // clear int requests
T3TCR = (1<<0); // CE = 1, enable timer
T3PR = 0;

T3MR0 = PCLK / RTOS_TICK_RATE; // int at TICK_RATE
T3MCR = TMCR_MR0_I | TMCR_MR0_R;
}


0 comments on commit c487b73

Please sign in to comment.