void init_Ints(void) // used to generate sinusoid with interrupts { IRQ_setVecs(vectors); IRQ_map(IRQ_EVT_XINT1,11); IRQ_reset(IRQ_EVT_XINT1); IRQ_enable(IRQ_EVT_XINT1); IRQ_nmiEnable(); IRQ_globalEnable(); }
void init_Ints(void) // used to generate sinusoid with interrupts { IRQ_setVecs(vectors); IRQ_reset(IRQ_EVT_XINT1); IRQ_map(IRQ_EVT_XINT1,11); IRQ_nmiEnable(); IRQ_globalEnable(); IRQ_enable(IRQ_EVT_XINT1); /* add your mappings to set up your interrupt (mcbsp, edma etc) here */ }
// for communication/init using interrupt void comm_intr() { // 0 since not polling poll=0; // disable interrupts IRQ_globalDisable(); // init DSP and codec c6713_dsk_init(); // McBSP1 Xmit CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle); // do not need to point to vector table #ifndef using_bios //point to the IRQ vector table IRQ_setVecs(vectors); //since interrupt vector handles this #endif // map McBSP1 Xmit to INT11 IRQ_map(CODECEventId, 11); // reset codec INT 11 IRQ_reset(CODECEventId); // globally enable interrupts IRQ_globalEnable(); // enable NMI interrupt IRQ_nmiEnable(); // enable CODEC eventXmit INT11 IRQ_enable(CODECEventId); // start McBSP interrupt outputting a sample output_sample(0); }
/*..........................................................................*/ 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); }
/* * usb_test() * USB Bulk transfer test. Device is detected as an eZDSP5535 when * connected to PC while test is running. Bulk transfers can be * made using USB_55xx program. * */ CSL_Status usb_test(void) { CSL_IRQ_Config config; CSL_Status result; Uint16 eventMask; result = CSL_USB_TEST_FAILED; usbConfig.opMode = CSL_USB_OPMODE_POLLED; usbConfig.devNum = CSL_USB0; usbConfig.maxCurrent = CSL_USB_MAX_CURRENT; usbConfig.appSuspendCallBack = (CSL_USB_APP_CALLBACK)CSL_suspendCallBack; usbConfig.appWakeupCallBack = (CSL_USB_APP_CALLBACK)CSL_selfWakeupCallBack; usbConfig.startTransferCallback = CSL_startTransferCallback; usbConfig.completeTransferCallback = CSL_completeTransferCallback; hEpObjArray[0] = &usbCtrlOutEpObj; hEpObjArray[1] = &usbCtrlInEpObj; hEpObjArray[2] = &usbBulkOutEpObj; hEpObjArray[3] = &usbBulkInEpObj; /* Set the interrupt vector start address */ IRQ_setVecs((Uint32)(&VECSTART)); /* Plug the USB Isr into vector table */ config.funcAddr = &usb_isr; IRQ_plug(USB_EVENT, config.funcAddr); /* Enable USB Interrupts */ IRQ_enable(USB_EVENT); /* Enable CPU Interrupts */ IRQ_globalEnable(); /* Initialize the USB module */ status = USB_init(&usbConfig); if(status != CSL_SOK) { printf("USB init failed\n"); return(result); } /* Reset the USB device */ status = USB_resetDev(CSL_USB0); if(status != CSL_SOK) { printf("USB Reset failed\n"); return(result); } /* Initialize the Control Endpoint OUT 0 */ eventMask = (CSL_USB_EVENT_RESET | CSL_USB_EVENT_SETUP | CSL_USB_EVENT_SUSPEND | CSL_USB_EVENT_RESUME | CSL_USB_EVENT_RESET | CSL_USB_EVENT_EOT); status = USB_initEndptObj(CSL_USB0, hEpObjArray[0], CSL_USB_OUT_EP0,CSL_USB_CTRL, CSL_USB_EP0_PACKET_SIZE, eventMask, NULL); if(status != CSL_SOK) { printf("USB End point init failed\n"); return(result); } /* Initialize the Control Endpoint IN 0 */ status = USB_initEndptObj(CSL_USB0, hEpObjArray[1], CSL_USB_IN_EP0, CSL_USB_CTRL, CSL_USB_EP0_PACKET_SIZE, CSL_USB_EVENT_EOT, NULL); if(status != CSL_SOK) { printf("USB End point init failed\n"); return(result); } /* Initialize the Bulk Endpoint IN 1 */ eventMask = (CSL_USB_EVENT_RESET | CSL_USB_EVENT_EOT); status = USB_initEndptObj(CSL_USB0, hEpObjArray[2], CSL_USB_IN_EP1, CSL_USB_BULK, CSL_USB_EP1_PACKET_SIZE_FS, eventMask, NULL); if(status != CSL_SOK) { printf("USB End point init failed\n"); return(result); } /* Initialize the Bulk Endpoint OUT 2 */ status = USB_initEndptObj(CSL_USB0, hEpObjArray[3], CSL_USB_OUT_EP1, CSL_USB_BULK, CSL_USB_EP1_PACKET_SIZE_FS, CSL_USB_EVENT_EOT, NULL); if(status != CSL_SOK) { printf("USB End point init failed\n"); return(result); } /* Set the parameters */ status = USB_setParams(CSL_USB0, hEpObjArray, FALSE); if(status != CSL_SOK) { printf("USB Set params failed\n"); return(result); } /* Connect the USB device */ status = USB_connectDev(CSL_USB0); if(status != CSL_SOK) { printf("USB Connect failed\n"); return(result); } deviceDescPtr = (Uint16 *)deviceDesc; cfgDescPtr = (Uint16 *)cfgDesc; strDescPtr = (Uint16 *)strDesc; dataReadBuffPtr = (Uint16 *)dataReadBuff; dataWriteBuffPtr = (Uint16 *)dataWriteBuff; while(stopRunning != TRUE); result = CSL_USB_TEST_PASSED; return(result); }
/** * \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); }