diff options
author | jaseg <jaseg@jaseg.net> | 2013-12-17 13:02:46 +0100 |
---|---|---|
committer | jaseg <jaseg@jaseg.net> | 2013-12-17 13:03:15 +0100 |
commit | 27ecd8933fd8b2a9c28a088ba30bafc14f5736a5 (patch) | |
tree | c1fdacbb3fbff08b91d094594c344d6c808eb238 | |
parent | e4fe36e15f03caccd25cf1ca97d22e0c489bdaa5 (diff) | |
download | matelight-27ecd8933fd8b2a9c28a088ba30bafc14f5736a5.tar.gz matelight-27ecd8933fd8b2a9c28a088ba30bafc14f5736a5.tar.bz2 matelight-27ecd8933fd8b2a9c28a088ba30bafc14f5736a5.zip |
Moved driverlib calls to MAP_ functions
-rw-r--r-- | firmware/main.c | 123 |
1 files changed, 62 insertions, 61 deletions
diff --git a/firmware/main.c b/firmware/main.c index cfe401a..3c8e000 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -31,6 +31,7 @@ #include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "driverlib/rom.h"
+#include "driverlib/rom_map.h"
#include "driverlib/udma.h"
#include "driverlib/ssi.h"
#include "usblib/usblib.h"
@@ -106,13 +107,13 @@ void SysTickIntHandler(void) { void SSI0IntHandler(void) {
/* FIXME is this necessary? */
unsigned long ssistatus = SSIIntStatus(SSI0_BASE, 1);
- SSIIntClear(SSI0_BASE, ssistatus);
+ MAP_SSIIntClear(SSI0_BASE, ssistatus);
- if(!uDMAChannelIsEnabled(11)){
+ if(!MAP_uDMAChannelIsEnabled(11)){
/* A TX DMA transfer was completed */
/* FIXME actually, just set a flag here and kick off when all four controllers signal completion.*/
/* Wait 1.2ms for the WS2801s to latch (the datasheet specifies at least 500µs) */
- SysCtlDelay(20000);
+ MAP_SysCtlDelay(20000);
kickoff_transfers();
}
}
@@ -195,38 +196,38 @@ void kickoff_transfers() { }
void kickoff_transfer(unsigned int channel, unsigned int offset, int base) {
- uDMAChannelTransferSet(channel | UDMA_PRI_SELECT, UDMA_MODE_BASIC, framebuffer_output+BUS_SIZE*offset, (void *)(base + SSI_O_DR), BUS_SIZE);
- uDMAChannelEnable(channel);
+ MAP_uDMAChannelTransferSet(channel | UDMA_PRI_SELECT, UDMA_MODE_BASIC, framebuffer_output+BUS_SIZE*offset, (void *)(base + SSI_O_DR), BUS_SIZE);
+ MAP_uDMAChannelEnable(channel);
}
void ssi_udma_channel_config(unsigned int channel) {
/* Set the USEBURST attribute for the uDMA SSI TX channel. This will force the controller to always use a burst
* when transferring data from the TX buffer to the SSI. This is somewhat more effecient bus usage than the default
* which allows single or burst transfers. */
- uDMAChannelAttributeEnable(channel, UDMA_ATTR_USEBURST);
+ MAP_uDMAChannelAttributeEnable(channel, UDMA_ATTR_USEBURST);
/* Configure the SSI Tx µDMA Channel to transfer from RAM to TX FIFO. The arbitration size is set to 4, which
* matches the SSI TX FIFO µDMA trigger threshold. */
- uDMAChannelControlSet(channel | UDMA_PRI_SELECT, UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_4);
+ MAP_uDMAChannelControlSet(channel | UDMA_PRI_SELECT, UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_4);
}
int main(void) {
/* Enable lazy stacking for interrupt handlers. This allows floating-point instructions to be used within interrupt
* handlers, but at the expense of extra stack usage. */
- FPULazyStackingEnable();
+ MAP_FPULazyStackingEnable();
/* Set clock to PLL at 50MHz */
- SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
+ MAP_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
/* Configure UART0 pins */
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
- GPIOPinConfigure(GPIO_PA0_U0RX);
- GPIOPinConfigure(GPIO_PA1_U0TX);
- GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
+ MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
+ MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
+ MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
/* Enable the GPIO pins for the LED (PF2 & PF3). */
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
- GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3|GPIO_PIN_2);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
+ MAP_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3|GPIO_PIN_2);
UARTStdioInit(0);
UARTprintf("Booting...\n\n");
@@ -234,80 +235,80 @@ int main(void) { g_bUSBConfigured = false;
/* Enable the GPIO peripheral used for USB, and configure the USB pins. */
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
- GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
+ MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
/* Enable the system tick. FIXME do we need this? */
- SysTickPeriodSet(SysCtlClockGet() / SYSTICKS_PER_SECOND);
- SysTickIntEnable();
- SysTickEnable();
+ MAP_SysTickPeriodSet(MAP_SysCtlClockGet() / SYSTICKS_PER_SECOND);
+ MAP_SysTickIntEnable();
+ MAP_SysTickEnable();
/* Configure USB */
USBBufferInit((tUSBBuffer *)&g_sRxBuffer);
USBStackModeSet(0, USB_MODE_FORCE_DEVICE, 0);
USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
- GPIOPinConfigure(GPIO_PA2_SSI0CLK);
- GPIOPinConfigure(GPIO_PA5_SSI0TX);
- GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
+ MAP_GPIOPinConfigure(GPIO_PA2_SSI0CLK);
+ MAP_GPIOPinConfigure(GPIO_PA5_SSI0TX);
+ MAP_GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_5);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
- GPIOPinConfigure(GPIO_PB4_SSI2CLK);
- GPIOPinConfigure(GPIO_PB7_SSI2TX);
- GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_7);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
+ MAP_GPIOPinConfigure(GPIO_PB4_SSI2CLK);
+ MAP_GPIOPinConfigure(GPIO_PB7_SSI2TX);
+ MAP_GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_7);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
- GPIOPinConfigure(GPIO_PD0_SSI3CLK);
- GPIOPinConfigure(GPIO_PD3_SSI3TX);
- GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_3);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
+ MAP_GPIOPinConfigure(GPIO_PD0_SSI3CLK);
+ MAP_GPIOPinConfigure(GPIO_PD3_SSI3TX);
+ MAP_GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_3);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
- GPIOPinConfigure(GPIO_PF2_SSI1CLK);
- GPIOPinConfigure(GPIO_PF1_SSI1TX);
- GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
+ MAP_GPIOPinConfigure(GPIO_PF2_SSI1CLK);
+ MAP_GPIOPinConfigure(GPIO_PF1_SSI1TX);
+ MAP_GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1);
/* Configure SSI0..3 for the ws2801's SPI-like protocol */
- SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
- SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
/* 200kBd */
- SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
- SSIConfigSetExpClk(SSI1_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
- SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
- SSIConfigSetExpClk(SSI3_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
+ MAP_SSIConfigSetExpClk(SSI0_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
+ MAP_SSIConfigSetExpClk(SSI1_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
+ MAP_SSIConfigSetExpClk(SSI2_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
+ MAP_SSIConfigSetExpClk(SSI3_BASE, MAP_SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
/* Configure the µDMA controller for use by the SPI interface */
- SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
- SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
+ MAP_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA);
// FIXME what do we need this for? IntEnable(INT_UDMAERR); // Enable µDMA error interrupt
- uDMAEnable();
- uDMAControlBaseSet(ucControlTable);
+ MAP_uDMAEnable();
+ MAP_uDMAControlBaseSet(ucControlTable);
- uDMAChannelAssign(UDMA_CH11_SSI0TX);
- uDMAChannelAssign(UDMA_CH25_SSI1TX);
- uDMAChannelAssign(UDMA_CH13_SSI2TX);
- uDMAChannelAssign(UDMA_CH15_SSI3TX);
+ MAP_uDMAChannelAssign(UDMA_CH11_SSI0TX);
+ MAP_uDMAChannelAssign(UDMA_CH25_SSI1TX);
+ MAP_uDMAChannelAssign(UDMA_CH13_SSI2TX);
+ MAP_uDMAChannelAssign(UDMA_CH15_SSI3TX);
ssi_udma_channel_config(11);
ssi_udma_channel_config(25);
ssi_udma_channel_config(13);
ssi_udma_channel_config(15);
- SSIDMAEnable(SSI0_BASE, SSI_DMA_TX);
- SSIDMAEnable(SSI1_BASE, SSI_DMA_TX);
- SSIDMAEnable(SSI2_BASE, SSI_DMA_TX);
- SSIDMAEnable(SSI3_BASE, SSI_DMA_TX);
+ MAP_SSIDMAEnable(SSI0_BASE, SSI_DMA_TX);
+ MAP_SSIDMAEnable(SSI1_BASE, SSI_DMA_TX);
+ MAP_SSIDMAEnable(SSI2_BASE, SSI_DMA_TX);
+ MAP_SSIDMAEnable(SSI3_BASE, SSI_DMA_TX);
- IntEnable(INT_SSI0);
+ MAP_IntEnable(INT_SSI0);
/* Enable the SSIs after configuring anything around them. */
- SSIEnable(SSI0_BASE);
- SSIEnable(SSI1_BASE);
- SSIEnable(SSI2_BASE);
- SSIEnable(SSI3_BASE);
+ MAP_SSIEnable(SSI0_BASE);
+ MAP_SSIEnable(SSI1_BASE);
+ MAP_SSIEnable(SSI2_BASE);
+ MAP_SSIEnable(SSI3_BASE);
UARTprintf("Booted.\n");
|