Freescale Semiconductor Inc.
    Regional Technical Application Center

 

E:/PROJECTS/IOP/ADC Average/Src/ADC_Filter/ADC_Filter_Drv/src/Pit.h File Reference

This file contains all Pit functions and definition declarations. More...

#include "Derivative.h"
#include "System_Cfg.h"
#include "Scheduler.h"
#include "Adc_Filter_ReportError.h"

Include dependency graph for Pit.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PIT_LOAD_VALUE(u8Pit_Ch, u32Val)
#define PIT_LOOP_TIME_100ms   ((float32_t)0.100 * (float32_t)SYS_FREQ)
#define PIT_LOOP_TIME_50ms   ((float32_t)0.050 * (float32_t)SYS_FREQ)
#define PIT_LOOP_TIME_5ms   ((float32_t)0.005 * (float32_t)SYS_FREQ)
#define PIT_CH_1   ((uint32_t)1)
#define PIT_CH_2   ((uint32_t)2)
#define PIT_CH_3   ((uint32_t)3)
#define PIT_CH_4   ((uint32_t)4)
#define PIT_CH_5   ((uint32_t)5)
#define _PIT_INT_TIME_33US_   ((uint32_t)0x0840)
#define PIT_BASE_OFFSET   ((uint8_t)148)
#define PIT_ENABLED(u8PitChannel)   (PIT_EN = (PIT_EN | ((uint32_t)1 << (uint32_t)u8PitChannel)));

Typedefs

typedef void(* Pit_CallbackType )(void)

Functions

void vfnPit_Init (uint8_t u8PitChannel, uint32_t u32Period)
 Configure desired Pit channel to operate with a resolution
frequency of 0.5% from the original operation frequency,
Pit timer setup to generate the desired Pwm period and Pwm
parameters.
void vfnPit_Set_Callback_Fnc (Pit_CallbackType Callback_Fnc)
 Sets the function to which the emios interrupt shall
jump once interrupt occurs.
void vfnPit_Ch1_Isr (void)
 Handles the timing for the generation of all Pwm signals.


Detailed Description

This file contains all Pit functions and definition declarations.

Copyright (c) 2008 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor

r01160

Guadalajara Applications Laboratory RTAC Americas

Version:
0.1
Date:
5/23/2008
Warning:
History:

Define Documentation

#define _PIT_INT_TIME_33US_   ((uint32_t)0x0840)

#define PIT_BASE_OFFSET   ((uint8_t)148)

Pit Vector Interrupt Offset

#define PIT_CH_1   ((uint32_t)1)

Pit Channel 1

#define PIT_CH_2   ((uint32_t)2)

Pit Channel 2

#define PIT_CH_3   ((uint32_t)3)

Pit Channel 3

#define PIT_CH_4   ((uint32_t)4)

Pit Channel 4

#define PIT_CH_5   ((uint32_t)5)

Pit Channel 5

#define PIT_ENABLED ( u8PitChannel   )     (PIT_EN = (PIT_EN | ((uint32_t)1 << (uint32_t)u8PitChannel)));

Enables a particular PIT channel timer.

#define PIT_LOAD_VALUE ( u8Pit_Ch,
u32Val   ) 

Value:

{                                               \
    switch(u8Pit_Ch)                            \
    {                                           \
       case 0:  PIT_TLVAL0 = (uint32_t)u32Val;  \
           break;                               \
       case 1:  PIT_TLVAL1 = (uint32_t)u32Val;  \
           break;                               \
       case 2:  PIT_TLVAL2 = (uint32_t)u32Val;  \
           break;                               \
       case 3:  PIT_TLVAL3 = (uint32_t)u32Val;  \
           break;                               \
       case 4:  PIT_TLVAL4 = (uint32_t)u32Val; \
           break;                               \
       case 5:  PIT_TLVAL5 = (uint32_t)u32Val; \
           break;                               \
       case 6:  PIT_TLVAL6 = (uint32_t)u32Val; \
           break;                               \
       case 7:  PIT_TLVAL7 = (uint32_t)u32Val;\
           break;                               \
       default:                                 \
           break;                               \
    }                                           \
}
Assign Counter value to desired Pit channel. Violates MISRA 2004 rule 11.3 and 14.3 because addressing memory mapped registers

#define PIT_LOOP_TIME_100ms   ((float32_t)0.100 * (float32_t)SYS_FREQ)

Timing constants

#define PIT_LOOP_TIME_50ms   ((float32_t)0.050 * (float32_t)SYS_FREQ)

#define PIT_LOOP_TIME_5ms   ((float32_t)0.005 * (float32_t)SYS_FREQ)


Typedef Documentation

typedef void(* Pit_CallbackType)(void)


Function Documentation

void vfnPit_Ch1_Isr ( void   ) 

Handles the timing for the generation of all Pwm signals.

Author:
R01160
Parameters:
none 
Returns:
none
Warning:
IF USER DECIDE TO USE OTHER INTERRUPT VECTOR RATHER THAN VECTOR 149 (PIT CH1)
MUST BE MANDATORY TO DECLARE THIS DIFFERENT VECTOR INTO VECTOR TABLE.

void vfnPit_Init ( uint8_t  u8PitChannel,
uint32_t  u32Period 
)

Configure desired Pit channel to operate with a resolution
frequency of 0.5% from the original operation frequency,
Pit timer setup to generate the desired Pwm period and Pwm
parameters.

Author:
R01160
Parameters:
Pit Channel to be used & Period Tick value
Returns:
none
Todo:
Warning:
Configured PIT channel when using this function will NOT be used
by another resource in the program flow, otherwise a wrong Pwm
frequency might be generated.

void vfnPit_Set_Callback_Fnc ( Pit_CallbackType  Callback_Fnc  ) 

Sets the function to which the emios interrupt shall
jump once interrupt occurs.

Author:
R01160
Parameters:
Emios_CallbackType - Callback type definition
Returns:
none
Warning:
This function will skip any null pointer parameter passed
as a input parameter.