Freescale Semiconductor Inc.
Main Page | Data Structures | File List | Data Fields | Globals

etpu_tg.h File Reference


Detailed Description

This file contains useful macros and prototypes for TG API.

Author:
Milan Brejl [r54529]
Version:
1.0
Date:
17-Mar-2014

Definition in file etpu_tg.h.

#include "etpu_util.h"
#include "etpu_tg_auto.h"

Go to the source code of this file.

Functions

uint32_t fs_etpu_tg_init (struct tg_instance_t *p_tg_instance, struct tg_config_t *p_tg_config)
 This function initializes eTPU channels to run TG function.
uint32_t fs_etpu_tg_config (struct tg_instance_t *p_tg_instance, struct tg_config_t *p_tg_config)
 This function changes the TG configuration.
uint32_t fs_etpu_tg_get_states (struct tg_instance_t *p_tg_instance, struct tg_states_t *p_tg_states)
 This function reads state parameter values of the TG function.


Function Documentation

uint32_t fs_etpu_tg_config struct tg_instance_t p_tg_instance,
struct tg_config_t p_tg_config
 

This function changes the TG configuration.

Note:
The following actions are performed in order:
  1. Write FM bits
Parameters:
*p_tg_instance - This is a pointer to the instance structure tg_instance_t.
*p_tg_config - This is a pointer to the structure of configuration parameters tg_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 193 of file etpu_tg.c.

References tg_config_t::accel_ratio, tg_instance_t::cpba, FS_ETPU_TG_OFFSET_ACCEL_RATIO, FS_ETPU_TG_OFFSET_GENERATION_DISABLE, FS_ETPU_TG_OFFSET_TOOTH_PERIOD_TARGET, tg_config_t::generation_disable, and tg_config_t::tooth_period_target.

uint32_t fs_etpu_tg_get_states struct tg_instance_t p_tg_instance,
struct tg_states_t p_tg_states
 

This function reads state parameter values of the TG function.

Note:
The following actions are performed in order:
  1. Read output parameter values from eTPU DATA RAM
  2. Clear TG error flags in eTPU DATA RAM
Parameters:
*p_tg_instance - This is a pointer to the instance structure tg_instance_t.
*p_tg_states - This is a pointer to the structure of states tg_states_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 231 of file etpu_tg.c.

References tg_instance_t::cpba, FS_ETPU_TG_OFFSET_TOOTH_COUNTER_CYCLE, FS_ETPU_TG_OFFSET_TOOTH_PERIOD_ACTUAL, tg_states_t::tooth_counter_cycle, and tg_states_t::tooth_period_actual.

uint32_t fs_etpu_tg_init struct tg_instance_t p_tg_instance,
struct tg_config_t p_tg_config
 

This function initializes eTPU channels to run TG function.

Note:
The following actions are performed in order:
  1. Use user-defined CPBA or allocate new eTPU DATA RAM
  2. Write chan config registers and FM bits
  3. Write channel parameters
  4. Write HSR
  5. Set channel priority
Parameters:
*p_tg_instance - This is a pointer to the instance structure tg_instance_t.
*p_tg_config - This is a pointer to the structure of configuration parameters tg_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_MALLOC - eTPU DATA RAM memory allocation error
  • FS_ETPU_ERROR_NONE - No error
Warning:
This function does not configure the pins, only the eTPU channels.

Definition at line 82 of file etpu_tg.c.

References tg_config_t::accel_ratio, tg_instance_t::cam_edge_count, tg_instance_t::chan_num_cam, tg_instance_t::chan_num_crank, tg_instance_t::cpba, tg_instance_t::cpba8_cam_edge_tooth, fs_etpu_data_ram_start, FS_ETPU_TG_FM1_CAM, FS_ETPU_TG_FM1_CRANK, FS_ETPU_TG_FUNCTION_NUMBER, FS_ETPU_TG_HSR_INIT, FS_ETPU_TG_NUM_PARMS, FS_ETPU_TG_OFFSET_ACCEL_RATIO, FS_ETPU_TG_OFFSET_CAM_CHAN, FS_ETPU_TG_OFFSET_GENERATION_DISABLE, FS_ETPU_TG_OFFSET_P_CAM_TOOTH, FS_ETPU_TG_OFFSET_P_CAM_TOOTH_FIRST, FS_ETPU_TG_OFFSET_TEETH_IN_GAP, FS_ETPU_TG_OFFSET_TEETH_PER_CYCLE, FS_ETPU_TG_OFFSET_TEETH_TILL_GAP, FS_ETPU_TG_OFFSET_TOOTH_COUNTER_CYCLE, FS_ETPU_TG_OFFSET_TOOTH_COUNTER_GAP, FS_ETPU_TG_OFFSET_TOOTH_PERIOD_ACTUAL, FS_ETPU_TG_OFFSET_TOOTH_PERIOD_TARGET, FS_ETPU_TG_OFFSET_TOOTH_TCR1_TIME, FS_ETPU_TG_TABLE_SELECT, tg_config_t::generation_disable, tg_instance_t::p_cam_edge_tooth, tg_instance_t::polarity_cam, tg_instance_t::polarity_crank, tg_instance_t::priority, tg_instance_t::teeth_in_gap, tg_instance_t::teeth_per_cycle, tg_instance_t::teeth_till_gap, and tg_config_t::tooth_period_target.