static void str7_IrqInit() { //设置外部中断 EIC_IRQConfig(ENABLE); XTI_Init(); XTI_ModeConfig(XTI_Interrupt, ENABLE ); EIC->SIR[XTI_IRQChannel] = ((int)XTI_IRQHandler << 16) | 8; EIC_IRQChannelConfig(XTI_IRQChannel, ENABLE); }
/* ----------------------- Start implementation -----------------------------*/ int main( void ) { EIC_Init( ); EIC_IRQConfig( ENABLE ); ( void )xTaskCreate( vInitTask, NULL, configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); vTaskStartScheduler( ); return 0; }
static void prvSetupTimerInterrupt( void ) { /* Set the watchdog up to generate a periodic tick. */ WDG_ECITConfig( DISABLE ); WDG_CntOnOffConfig( DISABLE ); WDG_PeriodValueConfig( portMICROS_PER_SECOND / configTICK_RATE_HZ ); /* Setup the tick interrupt in the EIC. */ EIC_IRQChannelPriorityConfig( WDG_IRQChannel, 1 ); EIC_IRQChannelConfig( WDG_IRQChannel, ENABLE ); EIC_IRQConfig( ENABLE ); WDG_ECITConfig( ENABLE ); /* Start the timer - interrupts are actually disabled at this point so it is safe to do this here. */ WDG_CntOnOffConfig( ENABLE ); }
/* * See the serial2.h header file. */ xComPortHandle xSerialPortInitMinimal( unsigned long ulWantedBaud, unsigned portBASE_TYPE uxQueueLength ) { xComPortHandle xReturn; /* Create the queues used to hold Rx and Tx characters. */ xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); xCharsForTx = xQueueCreate( uxQueueLength + 1, ( unsigned portBASE_TYPE ) sizeof( signed char ) ); /* If the queues were created correctly then setup the serial port hardware. */ if( ( xRxedChars != serINVALID_QUEUE ) && ( xCharsForTx != serINVALID_QUEUE ) ) { portENTER_CRITICAL(); { /* Setup the UART port pins. */ GPIO_Config( GPIO0, UART0_Tx_Pin, GPIO_AF_PP ); GPIO_Config( GPIO0, UART0_Rx_Pin, GPIO_IN_TRI_CMOS ); /* Configure the UART. */ UART_OnOffConfig( UART0, ENABLE ); UART_FifoConfig( UART0, DISABLE ); UART_FifoReset( UART0, UART_RxFIFO ); UART_FifoReset( UART0, UART_TxFIFO ); UART_LoopBackConfig(UART0, DISABLE ); UART_Config( UART0, ulWantedBaud, UART_NO_PARITY, UART_1_StopBits, UARTM_8D ); UART_RxConfig( UART0, ENABLE ); /* Configure the IEC for the UART interrupts. */ EIC_IRQChannelPriorityConfig( UART0_IRQChannel, 1 ); EIC_IRQChannelConfig( UART0_IRQChannel, ENABLE ); EIC_IRQConfig( ENABLE ); UART_ItConfig( UART0, UART_RxBufFull, ENABLE ); } portEXIT_CRITICAL(); } else { xReturn = ( xComPortHandle ) 0; } /* This demo file only supports a single port but we have to return something to comply with the standard demo header file. */ return xReturn; }