本文整理汇总了C++中ROM_SysTickPeriodSet函数的典型用法代码示例。如果您正苦于以下问题:C++ ROM_SysTickPeriodSet函数的具体用法?C++ ROM_SysTickPeriodSet怎么用?C++ ROM_SysTickPeriodSet使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROM_SysTickPeriodSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: system_SystickConfig
static void system_SystickConfig(uint32_t ui32_msInterval)
{
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() * ui32_msInterval / 1000);
SysTickIntRegister(&SysTickIntHandle);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
}
示例2: init
void init()
{
ROM_FPUEnable();
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIO_PORTB_DIR_R = 0x00;
GPIO_PORTB_DEN_R = 0xff;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_GREEN|LED_BLUE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 1000000);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER);
reset();
}
示例3: main
//****************************************************************************
//
// This is the main loop that runs the application.
//
//****************************************************************************
int
main(void)
{
//
// Set the clocking to run from the PLL at 50MHz.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Set the system tick to fire 100 times per second.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Pass the USB library our device information, initialize the USB
// controller and connect the device to the bus.
//
g_psCompDevices[0].pvInstance =
USBDHIDMouseCompositeInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice);
g_psCompDevices[1].pvInstance =
USBDCDCCompositeInit(0, (tUSBDCDCDevice *)&g_sCDCDevice);
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_DEVICE, 0);
//
// Pass the device information to the USB library and place the device
// on the bus.
//
USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE,
g_pucDescriptorData);
//
// Initialize the mouse and serial devices.
//
MouseInit();
SerialInit();
//
// Drop into the main loop.
//
while(1)
{
//
// Allow the main mouse routine to run.
//
MouseMain();
//
// Allow the main serial routine to run.
//
SerialMain();
}
}
示例4: timerInit
void timerInit()
{
#if F_CPU >= 80000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 50000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 40000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 25000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_8|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 16200000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN); //NOT PLL
#elif F_CPU >= 16100000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_OSC_INT|
SYSCTL_OSC_MAIN); //NOT PLL, INT OSC
#elif F_CPU >= 16000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_12_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 10000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_20|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#elif F_CPU >= 8000000
ROM_SysCtlClockSet(SYSCTL_SYSDIV_25|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#else
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
SYSCTL_OSC_MAIN);
#endif
//
// SysTick is used for delay() and delayMicroseconds()
//
// ROM_SysTickPeriodSet(0x00FFFFFF);
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND);
ROM_SysTickEnable();
//
//Initialize Timer5 to be used as time-tracker since beginning of time
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER5); //not tied to launchpad pin
ROM_TimerConfigure(TIMER5_BASE, TIMER_CFG_PERIODIC_UP);
ROM_TimerLoadSet(TIMER5_BASE, TIMER_A, ROM_SysCtlClockGet()/1000);
ROM_IntEnable(INT_TIMER5A);
ROM_TimerIntEnable(TIMER5_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerEnable(TIMER5_BASE, TIMER_A);
ROM_IntMasterEnable();
}
示例5: initSysTick
void initSysTick(void)
{
ROM_SysTickDisable();
ROM_SysTickPeriodSet( SYSTICK_PERIOD );
/* Write 0 to STCURRENT to clear counter */
*((volatile uint32_t *)NVIC_ST_CURRENT) = 0;
ROM_SysTickIntEnable();
ROM_SysTickEnable();
return;
}
示例6: main
//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
uint32_t ui32TxCount;
uint32_t ui32RxCount;
//uint32_t ui32Loop;
//
// 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.
//
ROM_FPULazyStackingEnable();
//
// Set the clocking to run from the PLL at 50MHz
//
#if 1
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Configure the required pins for USB operation.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);
//ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
/* This code taken from: http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/311237.aspx
*/
#else
#include "hw_nvic.h"
FlashErase(0x00000000);
ROM_IntMasterDisable();
ROM_SysTickIntDisable();
ROM_SysTickDisable();
uint32_t ui32SysClock;
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
ui32SysClock = ROM_SysCtlClockGet();
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
HWREG(NVIC_DIS0) = 0xffffffff;
HWREG(NVIC_DIS1) = 0xffffffff;
HWREG(NVIC_DIS2) = 0xffffffff;
HWREG(NVIC_DIS3) = 0xffffffff;
HWREG(NVIC_DIS4) = 0xffffffff;
int ui32Addr;
for(ui32Addr = NVIC_PRI0; ui32Addr <= NVIC_PRI34; ui32Addr+=4)
{
HWREG(ui32Addr) = 0;
}
HWREG(NVIC_SYS_PRI1) = 0;
HWREG(NVIC_SYS_PRI2) = 0;
HWREG(NVIC_SYS_PRI3) = 0;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);
ROM_SysCtlUSBPLLEnable();
ROM_SysCtlDelay(ui32SysClock*2 / 3);
ROM_IntMasterEnable();
ROM_UpdateUSB(0);
while(1)
{
}
#endif
#define BOOTLOADER_TEST 0
#if BOOTLOADER_TEST
#include "hw_nvic.h"
//ROM_UpdateUART();
// May need to do the following here:
// 0. See if this will cause bootloader to start
//ROM_FlashErase(0);
//ROM_UpdateUSB(0);
#define SYSTICKS_PER_SECOND 100
uint32_t ui32SysClock = ROM_SysCtlClockGet();
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//USBDCDTerm(0);
// Disable all interrupts
ROM_IntMasterDisable();
ROM_SysTickIntDisable();
ROM_SysTickDisable();
HWREG(NVIC_DIS0) = 0xffffffff;
HWREG(NVIC_DIS1) = 0xffffffff;
HWREG(NVIC_DIS2) = 0xffffffff;
HWREG(NVIC_DIS3) = 0xffffffff;
HWREG(NVIC_DIS4) = 0xffffffff;
int ui32Addr;
for(ui32Addr = NVIC_PRI0; ui32Addr <= NVIC_PRI34; ui32Addr+=4)
{
//.........这里部分代码省略.........
示例7: main
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
//
// Turn on stacking of FPU registers if FPU is used in the ISR.
//
FPULazyStackingEnable();
//
// Set the clocking to run from the PLL at 40MHz.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Set the system tick to fire 100 times per second.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Enable the Debug UART.
//
ConfigureUART();
//
// Print the welcome message to the terminal.
//
UARTprintf("\033[2JAir Mouse Application\n");
//
// Configure desired interrupt priorities. This makes certain that the DCM
// is fed data at a consistent rate. Lower numbers equal higher priority.
//
ROM_IntPrioritySet(INT_I2C3, 0x00);
ROM_IntPrioritySet(INT_GPIOB, 0x10);
ROM_IntPrioritySet(FAULT_SYSTICK, 0x20);
ROM_IntPrioritySet(INT_UART1, 0x60);
ROM_IntPrioritySet(INT_UART0, 0x70);
ROM_IntPrioritySet(INT_WTIMER5B, 0x80);
//
// Configure the USB D+ and D- pins.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);
//
// Pass the USB library our device information, initialize the USB
// controller and connect the device to the bus.
//
USBDHIDMouseCompositeInit(0, &g_sMouseDevice, &g_psCompDevices[0]);
USBDHIDKeyboardCompositeInit(0, &g_sKeyboardDevice, &g_psCompDevices[1]);
//
// Set the USB stack mode to Force Device mode.
//
USBStackModeSet(0, eUSBModeForceDevice, 0);
//
// Pass the device information to the USB library and place the device
// on the bus.
//
USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE,
g_pui8DescriptorData);
//
// User Interface Init
//
ButtonsInit();
RGBInit(0);
RGBEnable();
//
// Initialize the motion sub system.
//
MotionInit();
//
// Initialize the Radio Systems.
//
LPRFInit();
//
// Drop into the main loop.
//
while(1)
{
//
// Check for and handle timer tick events.
//
if(HWREGBITW(&g_ui32Events, USB_TICK_EVENT) == 1)
{
//.........这里部分代码省略.........
示例8: main
//*****************************************************************************
//
// This example demonstrates how to use the uDMA controller to transfer data
// between memory buffers and to and from a peripheral, in this case a UART.
// The uDMA controller is configured to repeatedly transfer a block of data
// from one memory buffer to another. It is also set up to repeatedly copy a
// block of data from a buffer to the UART output. The UART data is looped
// back so the same data is received, and the uDMA controlled is configured to
// continuously receive the UART data using ping-pong buffers.
//
// The processor is put to sleep when it is not doing anything, and this allows
// collection of CPU usage data to see how much CPU is being used while the
// data transfers are ongoing.
//
//*****************************************************************************
int
main(void)
{
static uint32_t ui32PrevSeconds;
static uint32_t ui32PrevXferCount;
static uint32_t ui32PrevUARTCount = 0;
uint32_t ui32XfersCompleted;
uint32_t ui32BytesTransferred;
//
// 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.
//
ROM_FPULazyStackingEnable();
//
// Set the clocking to run from the PLL at 50 MHz.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Enable peripherals to operate when CPU is in sleep.
//
ROM_SysCtlPeripheralClockGating(true);
//
// Enable the GPIO port that is used for the on-board LED.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
//
// Enable the GPIO pins for the LED (PF2).
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
//
// Initialize the UART.
//
ConfigureUART();
UARTprintf("\033[2JuDMA Example\n");
//
// Show the clock frequency on the display.
//
UARTprintf("Tiva C Series @ %u MHz\n\n", ROM_SysCtlClockGet() / 1000000);
//
// Show statistics headings.
//
UARTprintf("CPU Memory UART Remaining\n");
UARTprintf("Usage Transfers Transfers Time\n");
//
// Configure SysTick to occur 100 times per second, to use as a time
// reference. Enable SysTick to generate interrupts.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Initialize the CPU usage measurement routine.
//
CPUUsageInit(ROM_SysCtlClockGet(), SYSTICKS_PER_SECOND, 2);
//
// Enable the uDMA controller at the system level. Enable it to continue
// to run while the processor is in sleep.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UDMA);
//
// Enable the uDMA controller error interrupt. This interrupt will occur
// if there is a bus error during a transfer.
//
ROM_IntEnable(INT_UDMAERR);
//
// Enable the uDMA controller.
//
ROM_uDMAEnable();
//.........这里部分代码省略.........
示例9: main
//.........这里部分代码省略.........
// Enable the UART that we will be redirecting.
//
ROM_SysCtlPeripheralEnable(USB_UART_PERIPH);
//
// Enable and configure the UART RX and TX pins
//
ROM_SysCtlPeripheralEnable(TX_GPIO_PERIPH);
ROM_SysCtlPeripheralEnable(RX_GPIO_PERIPH);
ROM_GPIOPinTypeUART(TX_GPIO_BASE, TX_GPIO_PIN);
ROM_GPIOPinTypeUART(RX_GPIO_BASE, RX_GPIO_PIN);
//
// TODO: Add code to configure handshake GPIOs if required.
//
//
// Set the default UART configuration.
//
ROM_UARTConfigSetExpClk(USB_UART_BASE, ROM_SysCtlClockGet(),
DEFAULT_BIT_RATE, DEFAULT_UART_CONFIG);
ROM_UARTFIFOLevelSet(USB_UART_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8);
//
// Configure and enable UART interrupts.
//
ROM_UARTIntClear(USB_UART_BASE, ROM_UARTIntStatus(USB_UART_BASE, false));
ROM_UARTIntEnable(USB_UART_BASE, (UART_INT_OE | UART_INT_BE | UART_INT_PE |
UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX));
//
// Enable the system tick.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Tell the user what we are up to.
//
DisplayStatus(&g_sContext, " Configuring... ");
//
// Initialize the transmit and receive buffers.
//
USBBufferInit(&g_sTxBuffer);
USBBufferInit(&g_sRxBuffer);
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, eUSBModeDevice, 0);
//
// Pass our device information to the USB library and place the device
// on the bus.
//
USBDCDCInit(0, &g_sCDCDevice);
//
// Wait for initial configuration to complete.
//
DisplayStatus(&g_sContext, "Waiting for host");
//
// Clear our local byte counters.
示例10: main
//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
uint32_t ui32TxCount, ui32RxCount, ui32Fullness, ui32SysClock, ui32PLLRate;
tRectangle sRect;
char pcBuffer[16];
#ifdef USE_ULPI
uint32_t ui32Setting;
#endif
//
// Set the system clock to run at 120MHz from the PLL.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Configure the device pins.
//
PinoutSet();
#ifdef USE_ULPI
//
// Switch the USB ULPI Pins over.
//
USBULPIPinoutSet();
//
// Enable USB ULPI with high speed support.
//
ui32Setting = USBLIB_FEATURE_ULPI_HS;
USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32Setting);
//
// Setting the PLL frequency to zero tells the USB library to use the
// external USB clock.
//
ui32PLLRate = 0;
#else
//
// Save the PLL rate used by this application.
//
ui32PLLRate = 480000000;
#endif
//
// Enable the system tick.
//
ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Not configured initially.
//
g_ui32Flags = 0;
//
// Initialize the display driver.
//
Kentec320x240x16_SSD2119Init(ui32SysClock);
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&g_sContext, "usb-dev-serial");
//
// Fill the top 15 rows of the screen with blue to create the banner.
//
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.i16YMax = 23;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Show the various static text elements on the color STN display.
//
GrContextFontSet(&g_sContext, TEXT_FONT);
GrStringDraw(&g_sContext, "Tx bytes:", -1, 8, 80, false);
GrStringDraw(&g_sContext, "Tx buffer:", -1, 8, 105, false);
//.........这里部分代码省略.........
示例11: main
//*****************************************************************************
//
// Main application entry function.
//
//*****************************************************************************
int
main(void)
{
tBoolean bRetcode;
//
// Set the system clock to run at 50MHz from the PLL
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// NB: We don't call PinoutSet() in this testcase since the EM header
// expansion board doesn't currently have an I2C ID EEPROM. If we did
// call PinoutSet() this would configure all the EPI pins for SDRAM and
// we don't want to do this.
//
g_eDaughterType = DAUGHTER_NONE;
//
// Enable peripherals required to drive the LCD.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
//
// Configure SysTick for a 10Hz interrupt.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
//
// Initialize the display driver.
//
Kitronix320x240x16_SSD2119Init();
//
// Initialize the touch screen driver.
//
TouchScreenInit();
//
// Set the touch screen event handler.
//
TouchScreenCallbackSet(WidgetPointerMessage);
//
// Add the compile-time defined widgets to the widget tree.
//
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sHeading);
//
// Initialize the status string.
//
UpdateStatus(true, "Monitoring...");
//
// Paint the widget tree to make sure they all appear on the display.
//
WidgetPaint(WIDGET_ROOT);
//
// Initialize the SimpliciTI BSP.
//
BSP_Init();
//
// Set the SimpliciTI device address using the current Ethernet MAC address
// to ensure something like uniqueness.
//
bRetcode = SetSimpliciTIAddress();
//
// Did we have a problem with the address?
//
if(!bRetcode)
{
//
// Yes - make sure the display is updated then hang the app.
//
WidgetMessageQueueProcess();
while(1)
{
//
// MAC address is not set so hang the app.
//
}
}
//
// Initialize the SimpliciTI stack but don't set any receive callback.
//
//.........这里部分代码省略.........
示例12: main
//*****************************************************************************
//
// Main application entry function.
//
//*****************************************************************************
int
main(void)
{
tBoolean bRetcode;
smplStatus_t eRetcode;
ioctlScanChan_t sScan;
freqEntry_t pFreq[NWK_FREQ_TBL_SIZE];
tBoolean bFirstTimeThrough;
unsigned long ulLoop;
uint8_t ucLast;
//
// Set the system clock to run at 50MHz from the PLL
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// NB: We don't call PinoutSet() in this testcase since the EM header
// expansion board doesn't currently have an I2C ID EEPROM. If we did
// call PinoutSet() this would configure all the EPI pins for SDRAM and
// we don't want to do this.
//
g_eDaughterType = DAUGHTER_NONE;
//
// Enable peripherals required to drive the LCD.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
//
// Configure SysTick for a 10Hz interrupt.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
//
// Initialize the display driver.
//
Kitronix320x240x16_SSD2119Init();
//
// Initialize the touch screen driver.
//
TouchScreenInit();
//
// Set the touch screen event handler.
//
TouchScreenCallbackSet(WidgetPointerMessage);
//
// Add the compile-time defined widgets to the widget tree.
//
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sHeading);
//
// Initialize the status string.
//
UpdateStatus("Initializing...");
//
// Paint the widget tree to make sure they all appear on the display.
//
WidgetPaint(WIDGET_ROOT);
//
// Initialize the SimpliciTI BSP.
//
BSP_Init();
//
// Set the SimpliciTI device address using the current Ethernet MAC address
// to ensure something like uniqueness.
//
bRetcode = SetSimpliciTIAddress();
//
// Did we have a problem with the address?
//
if(!bRetcode)
{
//
// Yes - make sure the display is updated then hang the app.
//
WidgetMessageQueueProcess();
while(1)
{
//
// MAC address is not set so hang the app.
//
//.........这里部分代码省略.........
示例13: main
//*****************************************************************************
//
// This is the main application entry function.
//
//*****************************************************************************
int
main(void)
{
unsigned long ulTxCount;
unsigned long ulRxCount;
//
// Set the clocking to run from the PLL at 50MHz
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Enable the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("\033[2JBulk device application\n");
//
// Not configured initially.
//
g_bUSBConfigured = false;
//
// Enable the system tick.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Initialize the transmit and receive buffers.
//
USBBufferInit(&g_sTxBuffer);
USBBufferInit(&g_sRxBuffer);
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_DEVICE, 0);
//
// Pass our device information to the USB library and place the device
// on the bus.
//
USBDBulkInit(0, &g_sBulkDevice);
//
// Wait for initial configuration to complete.
//
UARTprintf("Waiting for host...\n");
//
// Clear our local byte counters.
//
ulRxCount = 0;
ulTxCount = 0;
//
// Main application loop.
//
while(1)
{
//
// See if any data has been transferred.
//
if((ulTxCount != g_ulTxCount) || (ulRxCount != g_ulRxCount))
{
//
// Take a snapshot of the latest transmit and receive counts.
//
ulTxCount = g_ulTxCount;
ulRxCount = g_ulRxCount;
//
// Update the display of bytes transferred.
//
UARTprintf("\rTx: %d Rx: %d", ulTxCount, ulRxCount);
}
}
}
示例14: main
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
tRectangle sRect;
uint_fast32_t ui32Retcode;
//
// Set the system clock to run at 50MHz from the PLL.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Configure SysTick for a 100Hz interrupt. The FatFs driver wants a 10 ms
// tick.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
//
// Configure and enable uDMA
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
SysCtlDelay(10);
ROM_uDMAControlBaseSet(&sDMAControlTable[0]);
ROM_uDMAEnable();
//
// Initialize the display driver.
//
CFAL96x64x16Init();
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sCFAL96x64x16);
//
// Fill the top 15 rows of the screen with blue to create the banner.
//
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.i16YMax = DISPLAY_BANNER_HEIGHT - 1;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
GrStringDrawCentered(&g_sContext, "usb-dev-msc", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 5, 0);
//
// Initialize the idle timeout and reset all flags.
//
g_ui32IdleTimeout = 0;
g_ui32Flags = 0;
//
// Initialize the state to idle.
//
g_eMSCState = MSC_DEV_DISCONNECTED;
//
// Draw the status bar and set it to idle.
//
UpdateStatus("Disconnected", 1);
//
// Enable the USB controller.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
//
// Set the USB pins to be controlled by the USB controller.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
ROM_GPIOPinConfigure(GPIO_PG4_USB0EPEN);
ROM_GPIOPinTypeUSBDigital(GPIO_PORTG_BASE, GPIO_PIN_4);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//.........这里部分代码省略.........
示例15: main
//*****************************************************************************
//
// This is the main example program. It checks to see that the interrupts are
// processed in the correct order when they have identical priorities,
// increasing priorities, and decreasing priorities. This exercises interrupt
// preemption and tail chaining.
//
//*****************************************************************************
int
main(void)
{
unsigned long ulError;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//
// Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("\033[2JInterrupts\n");
//
// Configure the F0, D1 and D2 to be outputs to indicate entry/exit of one
// of the interrupt handlers.
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,
GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2, 0);
//
// Set up and enable the SysTick timer. It will be used as a reference
// for delay loops in the interrupt handlers. The SysTick timer period
// will be set up for one second.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet());
ROM_SysTickEnable();
//
// Reset the error indicator.
//
ulError = 0;
//
// Enable interrupts to the processor.
//
ROM_IntMasterEnable();
//
// Enable the interrupts.
//
ROM_IntEnable(INT_GPIOA);
ROM_IntEnable(INT_GPIOB);
ROM_IntEnable(INT_GPIOC);
//
// Indicate that the equal interrupt priority test is beginning.
//
UARTprintf("\nEqual Priority\n");
//
// Set the interrupt priorities so they are all equal.
//
ROM_IntPrioritySet(INT_GPIOA, 0x00);
ROM_IntPrioritySet(INT_GPIOB, 0x00);
ROM_IntPrioritySet(INT_GPIOC, 0x00);
//
// Reset the interrupt flags.
//
g_ulGPIOa = 0;
g_ulGPIOb = 0;
g_ulGPIOc = 0;
g_ulIndex = 1;
//
// Trigger the interrupt for GPIO C.
//
HWREG(NVIC_SW_TRIG) = INT_GPIOC - 16;
//
// Put the current interrupt state on the LCD.
//
DisplayIntStatus();
//
// Verify that the interrupts were processed in the correct order.
//
//.........这里部分代码省略.........