/*..........................................................................*/ void BSP_init(void) { PLL_Config pllCfg_100MHz = { 0x8BE8U, 0x8000U, 0x0806U, 0x0000U }; PLL_Obj pllObj; uint16_t i; PLL_init(&pllObj, CSL_PLL_INST_0); PLL_reset(&pllObj); PLL_config(&pllObj, &pllCfg_100MHz); QF_zero(); /* clear the QF variables, see NOTE01 */ CSL_SYSCTRL_REGS->PCGCR1 = 0U; /* enable clocks to all peripherals */ CSL_SYSCTRL_REGS->PCGCR2 = 0U; CSL_SYSCTRL_REGS->EBSR = 0x1800U; /* configure I/O muxing */ CSL_SYSCTRL_REGS->PSRCR = 0x0020U; /* reset all peripherals */ CSL_SYSCTRL_REGS->PRCR = 0x00BFU; ULED_init(); /* configure the User LEDs... */ IRQ_globalDisable(); IRQ_disableAll(); /* disable all the interrupts */ IRQ_clearAll(); /* clear any pending interrupts */ IRQ_setVecs((uint32_t)&VECSTART); /* set the vector table */ for (i = 1U; i < 32U; ++i) { /* pre-fill the Vector table */ IRQ_plug(i, &illegal_isr); /* with illegal ISR */ } /* plug in all ISRs into the vector table...*/ // IRQ_plug(TINT_EVENT, &TINT_isr); // IRQ_plug(RTC_EVENT, &RTC_isr); /* ... */ if (QS_INIT((void *)0) == 0) { /* initialize the QS software tracing */ Q_ERROR(); } QS_OBJ_DICTIONARY(&l_TINT_isr); }
/** * \brief UART interrupt Test function * * This function verifies the UART operation in interrupt mode. * This function runs in an infinite loop to read the characters * from HyperTerminal and echo the characters back to HyperTerminal. * * \param none * * \return Test result(Only Failure Case) */ CSL_Status uart_IntcSample(void) { CSL_UartIsrAddr isrAddr; CSL_Status status; Uint32 sysClk; sysClk = getSysClk(); mySetup.clkInput = sysClk; /* Loop counter and error flag */ status = UART_init(&uartObj,CSL_UART_INST_0,UART_INTERRUPT); if(CSL_SOK != status) { printf("UART_init failed error code %d\n",status); return(status); } else { printf("UART_init Successful\n"); } /* Handle created */ hUart = (CSL_UartHandle)(&uartObj); /* Configure UART registers using setup structure */ status = UART_setup(hUart,&mySetup); if(CSL_SOK != status) { printf("UART_setup failed error code %d\n",status); return(status); } else { printf("UART_setup Successful\n"); } /* Send the details of the test to HyperTerminal */ status = UART_fputs(hUart,"\r\n\nUART INTERRUPT TEST!",0); if(CSL_SOK != status) { printf("UART_fputs failed error code %d\n",status); return(status); } status = UART_fputs(hUart,"\r\nTEST READS A CHARACTER FROM HYPERTERMINAL CONTINUOUSLY",0); if(CSL_SOK != status) { printf("UART_fputs failed error code %d\n",status); return(status); } status = UART_fputs(hUart,"\r\nENTER '$' TO END THE TEST\r\n",0); if(CSL_SOK != status) { printf("UART_fputs failed error code %d\n",status); return(status); } /* Configure and Register the UART interrupts */ isrAddr.rbiAddr = uart_rxIsr; isrAddr.tbeiAddr = uart_txIsr; isrAddr.ctoi = uart_ctoIsr; isrAddr.lsiAddr = uart_lsiIsr; /* Disable interrupt */ IRQ_globalDisable(); /* Clear any pending interrupts */ IRQ_clearAll(); /* Disable all the interrupts */ IRQ_disableAll(); IRQ_setVecs((Uint32)(&VECSTART)); /* Configuring Interrupt */ IRQ_plug (UART_EVENT, &UART_intrDispatch); /* Enabling Interrupt */ IRQ_enable(UART_EVENT); IRQ_globalEnable(); /* Set the UART callback function */ status = UART_setCallback(hUart,&isrAddr); if(status != CSL_SOK) { printf("UART_setCallback Failed\n"); return(status); } /* Enable the UART Events */ status = UART_eventEnable(hUart, CSL_UART_XMITOR_REG_EMPTY_INTERRUPT); if(status != CSL_SOK) { printf("UART_eventEnable Failed\n"); return(status); } status = UART_eventEnable(hUart, CSL_UART_RECVOR_REG_DATA_INTERRUPT); if(status != CSL_SOK) { printf("UART_eventEnable Failed\n"); return(status); } status = UART_eventEnable(hUart, CSL_UART_RECVOR_LINE_STATUS_INTERRUPT); if(status != CSL_SOK) { printf("UART_eventEnable Failed\n"); return(status); } /* Tests runs until users enters Symbol '$' on the HyperTerminal */ while(endOfTest == FALSE) { } printf("\nUSER ENTERED '$' on HyperTerminal\n"); printf("END OF TEST!\n"); /* Disable UART interrupts */ IRQ_disable(UART_EVENT); /* Disable GLobal Interrupts */ IRQ_globalDisable(); /* Send the END OF TEST MESSAGE to HyperTerminal */ status = UART_fputs(hUart,"\r\n\nYOU HAVE ENTERED '$'.",0); if(CSL_SOK != status) { printf("UART_fputs failed error code %d\n",status); return(status); } status = UART_fputs(hUart,"\r\nEND OF THE TEST!!\r\n",0); if(CSL_SOK != status) { printf("UART_fputs failed error code %d\n",status); return(status); } /* Disable interrupt */ IRQ_globalDisable(); /* Clear any pending interrupts */ IRQ_clearAll(); /* Disable all the interrupts */ IRQ_disableAll(); return(CSL_SOK); }