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

etpu_crank_emul.h File Reference


Detailed Description

This file contains useful macros and prototypes for CRANK_EMUL API.

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

Definition in file etpu_crank_emul.h.

#include "etpu_util.h"
#include "etpu_crank_auto.h"
#include "etpu_crank_emul_auto.h"

Go to the source code of this file.

Functions

uint32_t fs_etpu_crank_init (struct crank_instance_t *p_crank_instance, struct crank_config_t *p_crank_config)
 This function initializes eTPU channels to run CRANK_EMUL function.
uint32_t fs_etpu_crank_config (struct crank_instance_t *p_crank_instance, struct crank_config_t *p_crank_config)
 This function changes the CRANK configuration. In EMUL version, this has no effect!
uint32_t fs_etpu_crank_get_states (struct crank_instance_t *p_crank_instance, struct crank_states_t *p_crank_states)
 This function reads state parameter values of the CRANK function.
uint32_t fs_etpu_crank_set_sync (struct crank_instance_t *p_crank_instance, uint24_t tcr2_adjustment)
 In EMUL version, this function adjusts the TCR2 angle counter.
uint32_t fs_etpu_crank_set_speed (struct crank_instance_t *p_crank_instance, uint24_t tooth_period)
 This function sets the CRANK tooth_period and starts the CRANK angle counter if not started yet.
uint24_t * fs_etpu_crank_copy_tooth_period_log (struct crank_instance_t *p_crank_instance, uint24_t *p_tooth_period_log)
 This function copies the CRANK tooth_period_log into another array in RAM.


Function Documentation

uint32_t fs_etpu_crank_config struct crank_instance_t p_crank_instance,
struct crank_config_t p_crank_config
 

This function changes the CRANK configuration. In EMUL version, this has no effect!

Note:
The following actions are performed in order:
  1. Write configuration parameter values to eTPU DATA RAM
Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
*p_crank_config - This is a pointer to the structure of configuration parameters crank_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 191 of file etpu_crank_emul.c.

References crank_config_t::blank_teeth, crank_config_t::blank_time, crank_instance_t::cpba, crank_config_t::first_tooth_timeout, crank_config_t::gap_ratio, crank_config_t::teeth_per_sync, crank_config_t::win_ratio_across_gap, crank_config_t::win_ratio_after_gap, crank_config_t::win_ratio_after_timeout, and crank_config_t::win_ratio_normal.

uint24_t* fs_etpu_crank_copy_tooth_period_log struct crank_instance_t p_crank_instance,
uint24_t *  p_tooth_period_log
 

This function copies the CRANK tooth_period_log into another array in RAM.

Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
*p_tooth_period_log - This is a pointer where the CRANK tooth_period_log will be copied to. The amount of data copied in bytes is 4 * p_crank_instance->teeth_per_cycle.
Returns:
A pointer to a memory location just after the copied data.

Definition at line 350 of file etpu_crank_emul.c.

References crank_instance_t::cpba_tooth_period_log, and crank_instance_t::teeth_per_cycle.

uint32_t fs_etpu_crank_get_states struct crank_instance_t p_crank_instance,
struct crank_states_t p_crank_states
 

This function reads state parameter values of the CRANK function.

Note:
The following actions are performed in order:
  1. Read parameter values from eTPU DATA RAM
  2. Clear Crank error
Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
*p_crank_states - This is a pointer to the structure of states crank_states_t which is updated.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 235 of file etpu_crank_emul.c.

References crank_instance_t::cpba, crank_states_t::eng_pos_state, crank_states_t::error, fs_etpu_data_ram_start, crank_states_t::last_tooth_period, crank_states_t::state, crank_states_t::tooth_counter_cycle, and crank_states_t::tooth_counter_gap.

uint32_t fs_etpu_crank_init struct crank_instance_t p_crank_instance,
struct crank_config_t p_crank_config
 

This function initializes eTPU channels to run CRANK_EMUL 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 and global parameters
  4. Write HSR
  5. Set channel priority
Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
*p_crank_config - This is a pointer to the structure of configuration parameters crank_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 75 of file etpu_crank_emul.c.

References crank_config_t::blank_teeth, crank_config_t::blank_time, crank_instance_t::chan_num, crank_instance_t::cpba, crank_instance_t::cpba_tooth_period_log, crank_config_t::first_tooth_timeout, FS_ETPU_CRANK_EMUL_FUNCTION_NUMBER, FS_ETPU_CRANK_EMUL_NUM_PARMS, FS_ETPU_CRANK_EMUL_TABLE_SELECT, fs_etpu_data_ram_start, crank_config_t::gap_ratio, crank_instance_t::link_1, crank_instance_t::link_2, crank_instance_t::link_3, crank_instance_t::link_4, crank_instance_t::link_cam, crank_instance_t::log_tooth_periods, crank_instance_t::polarity, crank_instance_t::priority, crank_instance_t::tcr2_ticks_per_tooth, crank_instance_t::teeth_in_gap, crank_instance_t::teeth_per_cycle, crank_config_t::teeth_per_sync, crank_instance_t::teeth_till_gap, crank_config_t::win_ratio_across_gap, crank_config_t::win_ratio_after_gap, crank_config_t::win_ratio_after_timeout, and crank_config_t::win_ratio_normal.

uint32_t fs_etpu_crank_set_speed struct crank_instance_t p_crank_instance,
uint24_t  tooth_period
 

This function sets the CRANK tooth_period and starts the CRANK angle counter if not started yet.

Note:
The following actions are performed in order:
  1. Write channel parameter last_tooth_period
  2. Write HSR FS_ETPU_CRANK_HSR_SET_SPEED
Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
tooth_period - This is the TCR1 time value of a single tooth period.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 315 of file etpu_crank_emul.c.

References crank_instance_t::chan_num, crank_instance_t::cpba, and FS_ETPU_CRANK_HSR_SET_SPEED.

uint32_t fs_etpu_crank_set_sync struct crank_instance_t p_crank_instance,
uint24_t  tcr2_adjustment
 

In EMUL version, this function adjusts the TCR2 angle counter.

Note:
The following actions are performed in order:
  1. Write channel parameter tcr2_adjustment
  2. Write HSR FS_ETPU_CRANK_HSR_SET_SYNC
Parameters:
*p_crank_instance - This is a pointer to the instance structure crank_instance_t.
tcr2_adjustment - This is the TCR2 angle value corresponding to the fisrt tooth after the gap at which the recognized Cam log ends.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 277 of file etpu_crank_emul.c.

References crank_instance_t::chan_num, and crank_instance_t::cpba.