Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void tmrIntcPrdLoLoadDemo (
- void
- )
- {
- CSL_TmrObj TmrObj;
- CSL_Status intStat, status;
- CSL_TmrHwSetup hwSetup = CSL_TMR_HWSETUP_DEFAULTS;
- CSL_IntcEventHandlerRecord EventRecord;
- CSL_IntcParam vectId;
- Uint32 LoadValue = 100;
- CSL_TmrEnamode TimeCountMode =CSL_TMR_ENAMODE_CONT;
- /* Clear local data structures */
- memset(&TmrObj, 0, sizeof(CSL_TmrObj));
- printf("Running Gp Timer Interrupt DUAL UNCHAINED Low....\n");
- /**************************************************************
- * INTC related code *
- **************************************************************/
- /* Open INTC */
- vectId = CSL_INTC_VECTID_12;
- tmrIntcHandle = CSL_intcOpen(&tmrIntcObj, CSL_INTC_EVENTID_TINTLO0, &vectId,
- &intStat);
- /* Bind ISR to Interrupt */
- EventRecord.handler = (CSL_IntcEventHandler)&TimerInterruptHandler;
- EventRecord.arg = (void *)tmrIntcHandle;
- CSL_intcPlugEventHandler(tmrIntcHandle, &EventRecord);
- /* Event Enable */
- CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTENABLE, NULL);
- /**************************************************************/
- /* Initialize timer CSL module */
- CSL_tmrInit(NULL);
- hTmr = CSL_tmrOpen(&TmrObj, IntcInstance, NULL, &status);
- CSL_tmrHwSetup(hTmr, &hwSetup);
- /* Stop the Timer */
- status = CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMLO, NULL);
- /* set the timer mode to unchained dual mode */
- hwSetup.tmrTimerMode = CSL_TMR_TIMMODE_DUAL_UNCHAINED;
- CSL_tmrHwSetup(hTmr, &hwSetup);
- /* Load the period register */
- CSL_tmrHwControl(hTmr, CSL_TMR_CMD_LOAD_PRDLO, (void *)&LoadValue);
- /* Start the timer with one shot*/
- CSL_tmrHwControl(hTmr, CSL_TMR_CMD_START_TIMLO, (void *)&TimeCountMode);
- Uint32 count;
- while(intrCnt<=300)
- {
- CSL_tmrGetHwStatus(hTmr,CSL_TMR_QUERY_COUNT_LO,&count);
- printf("ok nie ma lipy:%d\n",count);
- }
- /* INTC related code */
- while (1) {
- if (intrCnt)
- break;
- }
- /**************************************************************/
- CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTDISABLE, NULL);
- printf("INTR: The Total number of Events occured are: 0x%d\n", intrCnt);
- intrCnt = 0;
- /* Stop the Timer */
- CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMLO, NULL);
- printf("Example for TIMLO completed\n");
- /* Close the Tmr instance */
- CSL_tmrClose(hTmr);
- CSL_intcClose(tmrIntcHandle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement