SHARE
TWEET

Untitled

a guest Apr 21st, 2014 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void tmrIntcPrdLoLoadDemo (
  2.     void
  3. )
  4. {
  5.     CSL_TmrObj TmrObj;
  6.     CSL_Status intStat, status;
  7.     CSL_TmrHwSetup hwSetup = CSL_TMR_HWSETUP_DEFAULTS;
  8.     CSL_IntcEventHandlerRecord EventRecord;
  9.     CSL_IntcParam vectId;
  10.  
  11.     Uint32 LoadValue = 100;
  12.  
  13.     CSL_TmrEnamode TimeCountMode =CSL_TMR_ENAMODE_CONT;
  14.  
  15.     /* Clear local data structures */
  16.     memset(&TmrObj, 0, sizeof(CSL_TmrObj));
  17.     printf("Running Gp Timer Interrupt DUAL UNCHAINED Low....\n");
  18.    
  19.     /**************************************************************
  20.     * INTC related code                               *
  21.     **************************************************************/
  22.      
  23.     /* Open INTC */
  24.     vectId = CSL_INTC_VECTID_12;
  25.  
  26.     tmrIntcHandle = CSL_intcOpen(&tmrIntcObj, CSL_INTC_EVENTID_TINTLO0, &vectId,
  27.                                  &intStat);
  28.  
  29.     /* Bind ISR to Interrupt */
  30.     EventRecord.handler = (CSL_IntcEventHandler)&TimerInterruptHandler;
  31.     EventRecord.arg = (void *)tmrIntcHandle;
  32.     CSL_intcPlugEventHandler(tmrIntcHandle, &EventRecord);
  33.    
  34.     /* Event Enable */
  35.     CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTENABLE, NULL);
  36.        
  37.     /**************************************************************/
  38.  
  39.     /* Initialize timer CSL module */
  40.     CSL_tmrInit(NULL);
  41.    
  42.     hTmr =  CSL_tmrOpen(&TmrObj, IntcInstance, NULL, &status);
  43.  
  44.     CSL_tmrHwSetup(hTmr, &hwSetup);
  45.  
  46.     /* Stop the Timer */
  47.     status = CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMLO, NULL);
  48.    
  49.     /* set the timer mode to unchained dual mode */
  50.     hwSetup.tmrTimerMode = CSL_TMR_TIMMODE_DUAL_UNCHAINED;
  51.  
  52.     CSL_tmrHwSetup(hTmr, &hwSetup);
  53.  
  54.     /* Load the period register */
  55.     CSL_tmrHwControl(hTmr, CSL_TMR_CMD_LOAD_PRDLO, (void *)&LoadValue);
  56.  
  57.     /* Start the timer with one shot*/
  58.     CSL_tmrHwControl(hTmr, CSL_TMR_CMD_START_TIMLO, (void *)&TimeCountMode);
  59.     Uint32 count;
  60.  
  61.     while(intrCnt<=300)
  62.     {
  63.     CSL_tmrGetHwStatus(hTmr,CSL_TMR_QUERY_COUNT_LO,&count);
  64.      printf("ok nie ma lipy:%d\n",count);
  65.     }
  66.     /* INTC related code */
  67.     while (1) {
  68.  
  69.         if (intrCnt)
  70.             break;
  71.     }
  72.  
  73.     /**************************************************************/
  74.    
  75.     CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTDISABLE, NULL);
  76.    
  77.     printf("INTR: The Total number of Events occured are: 0x%d\n", intrCnt);
  78.  
  79.     intrCnt = 0;
  80.  
  81.     /* Stop the Timer */
  82.     CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET_TIMLO, NULL);
  83.    
  84.     printf("Example for TIMLO completed\n");
  85.  
  86.     /* Close the Tmr instance */
  87.     CSL_tmrClose(hTmr);
  88.     CSL_intcClose(tmrIntcHandle);    
  89. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top