5 // Olimex board specific. LEDs are on P0.10, P0.11
7 #define partstFIRST_IO ((unsigned portLONG) 0x400)
8 #define partstNUM_LEDS (2)
9 #define partstALL_OUTPUTS_OFF ((unsigned portLONG) 0xffffffff)
14 void cpuSetupHardware (void)
18 // Remap the interrupt vectors to RAM if we are are running from RAM
20 SCB_MEMMAP = SCB_MEMMAP_URM;
24 // Configure the RS2332 pins. All other pins remain at their default of 0
26 PCB_PINSEL0 |= (PCB_PINSEL0_P00_TXD0 | PCB_PINSEL0_P01_RXD0 | PCB_PINSEL0_P08_TXD1 | PCB_PINSEL0_P09_RXD1);
29 // Set all GPIO to output other than the P0.14 (BSL), and the JTAG pins.
30 // The JTAG pins are left as input as I'm not sure what will happen if the
31 // Wiggler is connected after powerup - not that it would be a good idea to
34 GPIO0_IODIR = ~(GPIO_IO_P14 | GPIO_IO_P15 | GPIO_IO_P15);
35 GPIO1_IODIR = ~GPIO_IO_JTAG;
38 // Setup the PLL to multiply the 12Mhz XTAL input by 4, divide by 1
40 SCB_PLLCFG = (SCB_PLLCFG_MUL4 | SCB_PLLCFG_DIV1);
43 // Activate the PLL by turning it on then feeding the correct sequence of bytes
45 SCB_PLLCON = SCB_PLLCON_PLLE;
46 SCB_PLLFEED = SCB_PLLFEED_FEED1;
47 SCB_PLLFEED = SCB_PLLFEED_FEED2;
50 // Wait for the PLL to lock...
52 while (!(SCB_PLLSTAT & SCB_PLLSTAT_PLOCK))
56 // ...before connecting it using the feed sequence again
58 SCB_PLLCON = SCB_PLLCON_PLLC | SCB_PLLCON_PLLE;
59 SCB_PLLFEED = SCB_PLLFEED_FEED1;
60 SCB_PLLFEED = SCB_PLLFEED_FEED2;
63 // Setup and turn on the MAM. Three cycle access is used due to the fast
64 // PLL used. It is possible faster overall performance could be obtained by
65 // tuning the MAM and PLL settings.
71 // Setup the peripheral bus to be the same as the PLL output (48Mhz)
73 SCB_VPBDIV = SCB_VPBDIV_100;
76 // Disable power to all modules
89 void cpuPLLDisable (void)
92 SCB_PLLFEED = SCB_PLLFEED_FEED1;
93 SCB_PLLFEED = SCB_PLLFEED_FEED2;
100 void cpuT1Disable (void)
114 void cpuGPIOInitialize (void)
116 GPIO0_IOSET = partstALL_OUTPUTS_OFF;
119 void cpuToggleLED (unsigned portBASE_TYPE uxLED)
121 unsigned portLONG ulLED = partstFIRST_IO;
123 if (uxLED < partstNUM_LEDS)
125 ulLED <<= (unsigned portLONG) uxLED;
127 if (GPIO0_IOPIN & ulLED)