Freescale Semiconductor Inc.
    Regional Technical Application Center

 

Main Page | Class List | Directories | File List | File Members | Related Pages

Pit.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00017 /****************************************************************************************/
00018 #ifndef _PIT_H_
00019   #define _PIT_H_
00020   
00021   #include "Port.h"
00022   #include "Derivative.h"
00023   #include "Scheduler.h"
00024   #include "Pwm.h"
00025     
00026 /*------------------------- Type definitions --------------------------------------------------------------*/    
00027  typedef void(*Pit_CallbackType)(void);
00028     
00029 /*--------------------- Macros --------------------------*/
00031 #define PIT_LOAD_VALUE(u8Pit_Ch, u32Val)        \
00032 {                                               \
00033     switch(u8Pit_Ch)                            \
00034     {                                           \
00035        case 0:  PIT_TLVAL0 = (uint32_t)u32Val;  \
00036            break;                               \
00037        case 1:  PIT_TLVAL1 = (uint32_t)u32Val;  \
00038            break;                               \
00039        case 2:  PIT_TLVAL2 = (uint32_t)u32Val;  \
00040            break;                               \
00041        case 3:  PIT_TLVAL3 = (uint32_t)u32Val;  \
00042            break;                               \
00043        case 4:  PIT_TLVAL4 = (uint32_t)u32Val;  \
00044            break;                               \
00045        case 5:  PIT_TLVAL5 = (uint32_t)u32Val;  \
00046            break;                               \
00047        case 6:  PIT_TLVAL6 = (uint32_t)u32Val;  \
00048            break;                               \
00049        case 7:  PIT_TLVAL7 = (uint32_t)u32Val;  \
00050            break;                               \
00051        default:                                 \
00052            break;                               \
00053     }                                           \
00054 }
00055 
00056 
00058  #define PIT_CH_1         ((uint8_t)1)
00059 
00060  #define PIT_BASE_OFFSET  ((uint8_t)148)
00061 
00062  #define PWM_ENABLED         (PIT_EN  = (PIT_EN  | ((uint32_t)1<< (uint32_t)PIT_CH_1)))
00063  /*--------------------- Functions --------------------------*/
00064  void vfnPit_Init(uint8_t u8PitChannel, uint32_t u32Period);
00065  void vfnPit_Set_Callback_Fnc(Pit_CallbackType Callback_Fnc);
00066  void Pit_Pwm_Generation_Isr(void);  
00067  
00068 
00069 
00070 
00071 #endif