本文整理汇总了C++中ROM_SysCtlPeripheralEnable函数的典型用法代码示例。如果您正苦于以下问题:C++ ROM_SysCtlPeripheralEnable函数的具体用法?C++ ROM_SysCtlPeripheralEnable怎么用?C++ ROM_SysCtlPeripheralEnable使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ROM_SysCtlPeripheralEnable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeUartChannel
bool initializeUartChannel(uint8_t channel,
uint8_t uartPort,
uint32_t baudRate,
uint32_t cpuSpeedHz,
uint32_t flags)
{
if (channel >= UART_NUMBER_OF_CHANNELS ||
uartPort >= UART_COUNT)
{
return false;
}
if (uart2UartChannelData[uartPort] != 0)
{
return false;
}
if (!(flags & UART_FLAGS_RECEIVE) && !(flags & UART_FLAGS_SEND))
{
return false;
}
uint32_t uartBase;
uint32_t uartInterruptId;
uint32_t uartPeripheralSysCtl;
switch (uartPort)
{
#ifdef DEBUG
case UART_0:
{
uartBase = UART0_BASE;
uartInterruptId = INT_UART0;
uartPeripheralSysCtl = SYSCTL_PERIPH_UART0;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
break;
}
#endif
case UART_1:
{
uartBase = UART1_BASE;
uartInterruptId = INT_UART1;
uartPeripheralSysCtl = SYSCTL_PERIPH_UART1;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_GPIOPinConfigure(GPIO_PB0_U1RX);
ROM_GPIOPinConfigure(GPIO_PB1_U1TX);
ROM_GPIOPinTypeUART(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
break;
}
case UART_2:
{
uartBase = UART2_BASE;
uartInterruptId = INT_UART2;
uartPeripheralSysCtl = SYSCTL_PERIPH_UART2;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
ROM_GPIOPinConfigure(GPIO_PD6_U2RX);
ROM_GPIOPinConfigure(GPIO_PD7_U2TX);
ROM_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7);
break;
}
case UART_3:
{
uartBase = UART3_BASE;
uartInterruptId = INT_UART3;
uartPeripheralSysCtl = SYSCTL_PERIPH_UART3;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART3);
ROM_GPIOPinConfigure(GPIO_PC6_U3RX);
ROM_GPIOPinConfigure(GPIO_PC7_U3TX);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
break;
}
case UART_4:
{
uartBase = UART4_BASE;
uartInterruptId = INT_UART4;
uartPeripheralSysCtl = SYSCTL_PERIPH_UART4;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART4);
ROM_GPIOPinConfigure(GPIO_PC4_U4RX);
ROM_GPIOPinConfigure(GPIO_PC5_U4TX);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
break;
}
default:
{
return false;
}
}
UARTClockSourceSet(uartBase, UART_CLOCK_PIOSC);
if(!MAP_SysCtlPeripheralPresent(uartPeripheralSysCtl))
{
//.........这里部分代码省略.........
示例2: main
int main(void)
{
// setup the system clock to run at 80 MHz from the external crystal:
ROM_SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
// enable peripherals to operate when CPU is in sleep:
ROM_SysCtlPeripheralClockGating(true);
// enable all of the GPIOs:
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF);
// setup pins connected to RGB LED:
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
//setup the UART console
InitConsole();
// Test either the interrupts on a simple pushbutton to turn-on a led:
// 1- interrupt with static allocation on the vector table
// 2- interrupt with dynamic allocation on the vector table
// 2- interrupt with dynamic allocation on the vector table
// setup pin connected to SW1 and SW2
// Unlock PF0 so we can change it to a GPIO input
// Once we have enabled (unlocked) the commit register then re-lock it
// to prevent further changes. PF0 is muxed with NMI thus a special case.
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x01;
HWREG(GPIO_PORTF_BASE + GPIO_O_AFSEL) |= 0x000;
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0;
//Configures pin(s) for use as GPIO inputs
ROM_GPIOPinTypeGPIOInput(GPIO_PORTF_BASE,GPIO_PIN_4 | GPIO_PIN_0);
//Sets the pad configuration for the specified pin(s).
ROM_GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_4 | GPIO_PIN_0,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU);
// Make PORT F pin 0,4 high level triggered interrupts.
ROM_GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_PIN_4 | GPIO_PIN_0,GPIO_BOTH_EDGES);
//dynamic allocation on the vector table of GPIO_PORTF_isr interrupt handler
GPIOIntRegister(GPIO_PORTF_BASE, GPIO_PORTF_isr);
//Enables the specified GPIO interrupt
IntEnable(INT_GPIOF);
GPIOIntEnable(GPIO_PORTF_BASE,GPIO_INT_PIN_4 | GPIO_INT_PIN_0);
IntMasterEnable();
uint8_t PORTF_status;
//uint32_t ui32Loop = 0;
//
// Loop forever
//
while(1)
{
uint8_t PORTF_status=GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4);
/*
if(GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4))
{
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 ,0);
}
else
{
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 , GPIO_PIN_1);
}
*/
/*
//
// Turn on the red LED .
//
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 , GPIO_PIN_1);
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_PIN_7);
//
// Delay for a bit.
//
for(ui32Loop = 0; ui32Loop < 2000000; ui32Loop++)
{
}
//
// Turn on the green LED.
//
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 , GPIO_PIN_2);
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_7, 0);
//.........这里部分代码省略.........
示例3: main
//*****************************************************************************
//
// This example encrypts blocks of plaintext using TDES in CBC mode. It
// does the encryption first without uDMA and then with uDMA. The results
// are checked after each operation.
//
//*****************************************************************************
int
main(void)
{
uint32_t pui32CipherText[16], ui32Errors, ui32Idx, ui32SysClock;
//
// Run from the PLL at 120 MHz.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Configure the device pins.
//
PinoutSet(false, false);
//
// Initialize local variables.
//
ui32Errors = 0;
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) {
pui32CipherText[ui32Idx] = 0;
}
//
// Enable stacking for interrupt handlers. This allows floating-point
// instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPUStackingEnable();
//
// Enable DES interrupts.
//
ROM_IntEnable(INT_DES0);
//
// Enable debug output on UART0 and print a welcome message.
//
ConfigureUART();
UARTprintf("Starting TDES CBC encryption demo.\n");
//
// Enable the uDMA module.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
//
// Setup the control table.
//
ROM_uDMAEnable();
ROM_uDMAControlBaseSet(g_psDMAControlTable);
//
// Initialize the CCM and DES modules.
//
if(!DESInit()) {
UARTprintf("Initialization of the DES module failed.\n");
ui32Errors |= 0x00000001;
}
//
// Perform the encryption without uDMA.
//
UARTprintf("Performing encryption without uDMA.\n");
TDESCBCEncrypt(g_pui32TDESPlainText, pui32CipherText, g_pui32TDESKey,
64, g_pui32TDESIV, false);
//
// Check the result.
//
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) {
if(pui32CipherText[ui32Idx] != g_pui32TDESCipherText[ui32Idx]) {
UARTprintf("Ciphertext mismatch on word %d. Exp: 0x%x, Act: "
"0x%x\n", ui32Idx, g_pui32TDESCipherText[ui32Idx],
pui32CipherText[ui32Idx]);
ui32Errors |= (ui32Idx << 16) | 0x00000002;
}
}
//
// Clear the array containing the ciphertext.
//
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++) {
pui32CipherText[ui32Idx] = 0;
}
//
// Perform the encryption with uDMA.
//
UARTprintf("Performing encryption with uDMA.\n");
//.........这里部分代码省略.........
示例4: InitUART1Transfer
//*****************************************************************************
//
// Initializes the UART1 peripheral and sets up the TX and RX uDMA channels.
// The UART is configured for loopback mode so that any data sent on TX will be
// received on RX. The uDMA channels are configured so that the TX channel
// will copy data from a buffer to the UART TX output. And the uDMA RX channel
// will receive any incoming data into a pair of buffers in ping-pong mode.
//
//*****************************************************************************
void
InitUART1Transfer(void)
{
unsigned int uIdx;
//
// Fill the TX buffer with a simple data pattern.
//
for(uIdx = 0; uIdx < UART_TXBUF_SIZE; uIdx++)
{
g_ui8TxBuf[uIdx] = uIdx;
}
//
// Enable the UART peripheral, and configure it to operate even if the CPU
// is in sleep.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART1);
//
// Configure the UART communication parameters.
//
ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 115200,
UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE);
//
// Set both the TX and RX trigger thresholds to 4. This will be used by
// the uDMA controller to signal when more data should be transferred. The
// uDMA TX and RX channels will be configured so that it can transfer 4
// bytes in a burst when the UART is ready to transfer more data.
//
ROM_UARTFIFOLevelSet(UART1_BASE, UART_FIFO_TX4_8, UART_FIFO_RX4_8);
//
// Enable the UART for operation, and enable the uDMA interface for both TX
// and RX channels.
//
ROM_UARTEnable(UART1_BASE);
ROM_UARTDMAEnable(UART1_BASE, UART_DMA_RX | UART_DMA_TX);
//
// This register write will set the UART to operate in loopback mode. Any
// data sent on the TX output will be received on the RX input.
//
HWREG(UART1_BASE + UART_O_CTL) |= UART_CTL_LBE;
//
// Enable the UART peripheral interrupts. Note that no UART interrupts
// were enabled, but the uDMA controller will cause an interrupt on the
// UART interrupt signal when a uDMA transfer is complete.
//
ROM_IntEnable(INT_UART1);
//
// Put the attributes in a known state for the uDMA UART1RX channel. These
// should already be disabled by default.
//
ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_UART1RX,
UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
//
// Configure the control parameters for the primary control structure for
// the UART RX channel. The primary contol structure is used for the "A"
// part of the ping-pong receive. The transfer data size is 8 bits, the
// source address does not increment since it will be reading from a
// register. The destination address increment is byte 8-bit bytes. The
// arbitration size is set to 4 to match the RX FIFO trigger threshold.
// The uDMA controller will use a 4 byte burst transfer if possible. This
// will be somewhat more effecient that single byte transfers.
//
ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART1RX | UDMA_PRI_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 |
UDMA_ARB_4);
//
// Configure the control parameters for the alternate control structure for
// the UART RX channel. The alternate contol structure is used for the "B"
// part of the ping-pong receive. The configuration is identical to the
// primary/A control structure.
//
ROM_uDMAChannelControlSet(UDMA_CHANNEL_UART1RX | UDMA_ALT_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 |
UDMA_ARB_4);
//
// Set up the transfer parameters for the UART RX primary control
// structure. The mode is set to ping-pong, the transfer source is the
//.........这里部分代码省略.........
示例5: 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);
//
// 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[2JMouse device application\n");
//
// Set the system tick to fire 100 times per second.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_DEVICE, 0);
//
// Pass the USB library our device information, initialize the USB
// controller and connect the device to the bus.
//
USBDHIDMouseInit(0, (tUSBDHIDMouseDevice *)&g_sMouseDevice);
//
// Drop into the main loop.
//
while(1)
{
//
// Tell the user what we are doing.
//
UARTprintf("Waiting for host...\n");
//
// Wait for USB configuration to complete.
//
while(!g_bConnected)
{
}
//
// Update the status.
//
UARTprintf("Host connected...\n");
//
// Now keep processing the mouse as long as the host is connected.
//
while(g_bConnected)
{
//
// If it is time to move the mouse then do so.
//
if(HWREGBITW(&g_ulCommands, TICK_EVENT) == 1)
{
HWREGBITW(&g_ulCommands, TICK_EVENT) = 0;
MoveHandler();
}
}
//
// Update the status.
//
UARTprintf("Host disconnected...\n");
}
}
示例6: 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();
//
// Configure and enable uDMA
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
SysCtlDelay(10);
ROM_uDMAControlBaseSet(&sDMAControlTable[0]);
ROM_uDMAEnable();
//
// Initialize the idle timeout and reset all flags.
//
g_ulIdleTimeout = 0;
g_ulFlags = 0;
g_eMSCState = MSC_DEV_DISCONNECTED;
//
// Pass the USB library our device information, initialize the USB
// controller and connect the device to the bus.
//
g_psCompDevices[0].pvInstance =
USBDMSCInit(0, (tUSBDMSCDevice *)&g_sMSCDevice);
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);
SerialInit();
disk_initialize(0);
//
// Drop into the main loop.
//
while(1)
{
//
// Allow the main serial routine to run.
//
SerialMain();
switch(g_eMSCState)
{
case MSC_DEV_READ:
{
//
// Update the screen if necessary.
//
if(g_ulFlags & FLAG_UPDATE_STATUS)
{
g_ulFlags &= ~FLAG_UPDATE_STATUS;
}
//
// If there is no activity then return to the idle state.
//
if(g_ulIdleTimeout == 0)
{
g_eMSCState = MSC_DEV_IDLE;
}
break;
}
//.........这里部分代码省略.........
示例7: main
//*****************************************************************************
//
// This example application demonstrates the use of the timers to generate
// periodic interrupts.
//
//*****************************************************************************
int
main(void)
{
tRectangle sRect;
//
// 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 directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the display driver.
//
CFAL96x64x16Init();
//
// Initialize the graphics context and find the middle X coordinate.
//
GrContextInit(&g_sContext, &g_sCFAL96x64x16);
//
// Fill the top part of the screen with blue to create the banner.
//
sRect.i16XMin = 0;
sRect.i16YMin = 0;
sRect.i16XMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.i16YMax = 9;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Change foreground for white text.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
GrStringDrawCentered(&g_sContext, "timers", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);
//
// Initialize timer status display.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
GrStringDraw(&g_sContext, "Timer 0:", -1, 16, 26, 0);
GrStringDraw(&g_sContext, "Timer 1:", -1, 16, 36, 0);
//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
//
// Enable processor interrupts.
//
ROM_IntMasterEnable();
//
// Configure the two 32-bit periodic timers.
//
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() / 2);
//
// Setup the interrupts for the timer timeouts.
//
ROM_IntEnable(INT_TIMER0A);
ROM_IntEnable(INT_TIMER1A);
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
//
// Enable the timers.
//
ROM_TimerEnable(TIMER0_BASE, TIMER_A);
ROM_TimerEnable(TIMER1_BASE, TIMER_A);
//
// Loop forever while the timers run.
//
while(1)
//.........这里部分代码省略.........
示例8: main
//*****************************************************************************
//
// This example encrypts blocks ciphertext using AES128 in GCM mode. It
// does the encryption first without uDMA and then with uDMA. The results
// are checked after each operation.
//
//*****************************************************************************
int
main(void)
{
uint32_t pui32CipherText[64], pui32Tag[4], pui32Y0[4], ui32Errors, ui32Idx;
uint32_t *pui32Key, ui32IVLength, *pui32IV, ui32DataLength;
uint32_t *pui32ExpCipherText, ui32AuthDataLength, *pui32AuthData;
uint32_t *pui32PlainText, *pui32ExpTag;
uint8_t ui8Vector;
uint32_t ui32KeySize;
uint32_t ui32SysClock;
tContext sContext;
//
// Run from the PLL at 120 MHz.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Configure the device pins.
//
PinoutSet();
//
// Initialize the display driver.
//
Kentec320x240x16_SSD2119Init(ui32SysClock);
//
// Initialize the graphics context.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&sContext, "aes-gcm-encrypt");
//
// Show some instructions on the display
//
GrContextFontSet(&sContext, g_psFontCm20);
GrContextForegroundSet(&sContext, ClrWhite);
GrStringDrawCentered(&sContext, "Connect a terminal to", -1,
GrContextDpyWidthGet(&sContext) / 2, 60, false);
GrStringDrawCentered(&sContext, "UART0 (115200,N,8,1)", -1,
GrContextDpyWidthGet(&sContext) / 2, 80, false);
GrStringDrawCentered(&sContext, "for more information.", -1,
GrContextDpyWidthGet(&sContext) / 2, 100, false);
//
// Initialize local variables.
//
ui32Errors = 0;
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++)
{
pui32CipherText[ui32Idx] = 0;
}
for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)
{
pui32Tag[ui32Idx] = 0;
}
//
// Enable stacking for interrupt handlers. This allows floating-point
// instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPUStackingEnable();
//
// Enable AES interrupts.
//
ROM_IntEnable(INT_AES0);
//
// Enable debug output on UART0 and print a welcome message.
//
ConfigureUART();
UARTprintf("Starting AES GCM encryption demo.\n");
GrStringDrawCentered(&sContext, "Starting demo...", -1,
GrContextDpyWidthGet(&sContext) / 2, 140, false);
//
// Enable the uDMA module.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
//
// Setup the control table.
//
//.........这里部分代码省略.........
示例9: main
//*****************************************************************************
//
// Print "Hello World!" to the UART on the evaluation board.
//
//*****************************************************************************
int
main(void)
{
//volatile 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 directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |
SYSCTL_OSC_MAIN);
//
// 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 & PF3).
//
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
//
// Initialize the UART.
//
ConfigureUART();
//
// Hello!
//
UARTprintf("Hello, world!\n");
//
// We are finished. Hang around doing nothing.
//
while(1)
{
//
// Turn on the BLUE LED.
//
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Delay for a bit.
//
SysCtlDelay(SysCtlClockGet() / 10 / 3);
//
// Turn off the BLUE LED.
//
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
//
// Delay for a bit.
//
SysCtlDelay(SysCtlClockGet() / 10 / 3);
}
}
示例10: main
//*****************************************************************************
//
// Demonstrate the use of the USB stick update example.
//
//*****************************************************************************
int
main(void)
{
unsigned long ulCount;
//
// 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 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("\n\nUSB Stick Update Demo\n---------------------\n\n");
//
// Enable the GPIO module which the select button is attached to.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
//
// Indicate what is happening.
//
UARTprintf("Press the user button to start the USB stick updater\n\n");
//
// Enable the GPIO pin to read the select button.
//
ROM_GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN);
ROM_GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
//
// Wait for the pullup to take effect or the next loop will exist too soon.
//
SysCtlDelay(1000);
//
// Wait until the select button has been pressed for ~40ms (in order to
// debounce the press).
//
ulCount = 0;
while(1)
{
//
// See if the button is pressed.
//
if(ROM_GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_4) == 0)
{
//
// Increment the count since the button is pressed.
//
ulCount++;
//
// If the count has reached 4, then the button has been debounced
// as being pressed.
//
if(ulCount == 4)
{
break;
}
}
else
{
//
// Reset the count since the button is not pressed.
//
ulCount = 0;
}
//
// Delay for approximately 10ms.
//
SysCtlDelay(16000000 / (3 * 100));
}
//
// Wait until the select button has been released for ~40ms (in order to
// debounce the release).
//
ulCount = 0;
while(1)
{
//
// See if the button is pressed.
//
if(ROM_GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_4) != 0)
{
//.........这里部分代码省略.........
示例11: enable_lcd
/**
* Enable Port and set GPIO to output
*/
void enable_lcd()
{
ROM_SysCtlPeripheralEnable( LCD_PERIPHERAL );
ROM_GPIOPinTypeGPIOOutput( LCD_PORT, LCD_CS | LCD_SCL | LCD_SI | LCD_RST );
}
示例12: main
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
unsigned long ulButton, ulPrevious, ulLastTickCount;
tBoolean bLastSuspend;
//
// 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 USB pins
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
//
// 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[2JKeyboard device application\n");
//
// Enable the GPIO that is used for the on-board push button.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);
ROM_GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
//
// Enable the GPIO that is used for the on-board LED.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0);
//
// Not configured initially.
//
g_bConnected = false;
g_bSuspended = false;
bLastSuspend = false;
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_DEVICE, 0);
//
// Pass our device information to the USB HID device class driver,
// initialize the USB
// controller and connect the device to the bus.
//
USBDHIDKeyboardInit(0, &g_sKeyboardDevice);
//
// Set the system tick to fire 100 times per second.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / SYSTICKS_PER_SECOND);
ROM_SysTickIntEnable();
ROM_SysTickEnable();
//
// The main loop starts here. We begin by waiting for a host connection
// then drop into the main keyboard handling section. If the host
// disconnects, we return to the top and wait for a new connection.
//
ulPrevious = 1;
setup();
while(1)
{
//
// Tell the user what we are doing and provide some basic instructions.
//
UARTprintf("Waiting for host...\n");
//
// Wait for USB configuration to complete.
//
while(!g_bConnected)
{
}
//
// Update the status.
//
//.........这里部分代码省略.........
示例13: main
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
tRectangle sRect;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
//
// Enable the USB mux GPIO.
//
ROM_SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH);
//
// The LM3S3748 board uses a USB mux that must be switched to use the
// host connector and not the device connecter.
//
ROM_GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN);
ROM_GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE);
//
// 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);
uDMAControlBaseSet(&sDMAControlTable[0]);
uDMAEnable();
//
// Initialize the display driver.
//
Formike128x128x16Init();
//
// Turn on the backlight.
//
Formike128x128x16BacklightOn();
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sFormike128x128x16);
//
// Fill the top 15 rows of the screen with blue to create the banner.
//
sRect.sXMin = 0;
sRect.sYMin = 0;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.sYMax = DISPLAY_BANNER_HEIGHT;
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_pFontFixed6x8);
GrStringDrawCentered(&g_sContext, "usb_dev_msc", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 7, 0);
//
// Initialize the idle timeout and reset all flags.
//
g_ulIdleTimeout = 0;
g_ulFlags = 0;
//
// Initialize the state to idle.
//
g_eMSCState = MSC_DEV_IDLE;
//
// Draw the status bar and set it to idle.
//
UpdateStatus("Idle", 1);
//
// Pass our device information to the USB library and place the device
//.........这里部分代码省略.........
示例14: main
// After a certain number of edges are captured, the application prints out
// the results and compares the elapsed time between edges to the expected
// value.
//
// Note that the "B" timer is used because on some devices the "A" timer does
// not work correctly with the uDMA controller. Refer to the chip errata for
// details.
//
//*****************************************************************************
int
main(void)
{
unsigned long ulIdx;
unsigned short usTimerElapsed;
//unsigned short usTimerErr;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the UART and write a status message.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_EVEN));
//UARTStdioInit(0);
//UARTprintf("\033[2JuDMA edge capture timer example\n\n");
//UARTprintf("This example requires that PD0 and PD7 be jumpered together"
// "\n\n");
//
// Create a signal source that can be used as an input for the CCP1 pin.
//
SetupSignalSource();
//
// Enable the GPIO port used for the CCP1 input.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
//
// Configure the Timer0 CCP1 function to use PD7
//
GPIOPinConfigure(GPIO_PB2_CCP3);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_2);
//
// Set up Timer0B for edge-timer mode, positive edge
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
TimerConfigure(TIMER1_BASE, TIMER_CFG_16_BIT_PAIR | TIMER_CFG_B_CAP_TIME);
TimerControlEvent(TIMER1_BASE, TIMER_B, TIMER_EVENT_BOTH_EDGES);
TimerLoadSet(TIMER1_BASE, TIMER_B, 0xffff);
//
// Enable the uDMA peripheral
//
ROM_SysCtlPeripheralEnable(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();
//
// Point at the control table to use for channel control structures.
//
ROM_uDMAControlBaseSet(ucControlTable);
//
// Put the attributes in a known state for the uDMA Timer0B channel. These
// should already be disabled by default.
//
ROM_uDMAChannelAttributeDisable(UDMA_CHANNEL_TMR1B,
UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
//
// Configure DMA channel for Timer0B to transfer 16-bit values, 1 at a
// time. The source is fixed and the destination increments by 16-bits
// (2 bytes) at a time.
//
ROM_uDMAChannelControlSet(UDMA_CHANNEL_TMR1B | UDMA_PRI_SELECT,
//.........这里部分代码省略.........
示例15: main
int main(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
if(ROM_EEPROMInit() == EEPROM_INIT_ERROR) {
if(ROM_EEPROMInit() != EEPROM_INIT_ERROR)
EEPROMMassErase();
}
timerInit();
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
#ifdef TARGET_IS_SNOWFLAKE_RA0
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOR);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOS);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOT);
#endif
//Unlock and commit NMI pins PD7 and PF0
HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = 0x4C4F434B;
HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= 0x1;
HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = 0x4C4F434B;
HWREG(GPIO_PORTD_BASE + GPIO_O_CR) |= 0x80;
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
}