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

etpu_fuel.c File Reference


Detailed Description

This file contains API for using the eTPU function Fuel Port Injection (FUEL).

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

Definition in file etpu_fuel.c.

#include "etpu_fuel.h"
#include "etpu_util.h"

Go to the source code of this file.

Functions

uint32_t fs_etpu_fuel_init (struct fuel_instance_t *p_fuel_instance, struct fuel_config_t *p_fuel_config)
 This function initializes eTPU channels to run FUEL function.
uint32_t fs_etpu_fuel_config (struct fuel_instance_t *p_fuel_instance, struct fuel_config_t *p_fuel_config)
 This function changes the FUEL configuration.
uint32_t fs_etpu_fuel_update_injection_time (struct fuel_instance_t *p_fuel_instance, struct fuel_config_t *p_fuel_config)
 This function updates the FUEL injection_time.
uint32_t fs_etpu_fuel_get_states (struct fuel_instance_t *p_fuel_instance, struct fuel_states_t *p_fuel_states)
 This function reads FUEL state variables, including error flags, and clears the eTPU error after reading.

Variables

uint32_t fs_etpu_data_ram_start
uint32_t fs_etpu_data_ram_ext


Function Documentation

uint32_t fs_etpu_fuel_config struct fuel_instance_t p_fuel_instance,
struct fuel_config_t p_fuel_config
 

This function changes the FUEL configuration.

Warning:
The new injection_time is applied from the next fuel injection. Use fs_etpu_fuel_update_injection_time() in order to update the current injection.
Note:
The following actions are performed in order:
  1. Write configuration parameter values to eTPU DATA RAM
Parameters:
*p_fuel_instance - This is a pointer to the instance structure inj_instance_t.
*p_fuel_config - This is a pointer to the structure of configuration parameters inj_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error.

Definition at line 181 of file etpu_fuel.c.

References fuel_config_t::angle_normal_end, fuel_config_t::angle_offset_recalc, fuel_config_t::angle_stop, fuel_config_t::compensation_time, fuel_instance_t::cpba, FS_ETPU_FUEL_OFFSET_ANGLE_NORMAL_END, FS_ETPU_FUEL_OFFSET_ANGLE_OFFSET_RECALC, FS_ETPU_FUEL_OFFSET_ANGLE_STOP, FS_ETPU_FUEL_OFFSET_COMPENSATION_TIME, FS_ETPU_FUEL_OFFSET_GENERATION_DISABLE, FS_ETPU_FUEL_OFFSET_INJECTION_TIME, FS_ETPU_FUEL_OFFSET_INJECTION_TIME_MINIMUM, FS_ETPU_FUEL_OFFSET_OFF_TIME_MINIMUM, fuel_config_t::generation_disable, fuel_config_t::injection_time, fuel_config_t::injection_time_minimum, and fuel_config_t::off_time_minimum.

uint32_t fs_etpu_fuel_get_states struct fuel_instance_t p_fuel_instance,
struct fuel_states_t p_fuel_states
 

This function reads FUEL state variables, including error flags, and clears the eTPU error after reading.

Note:
The following actions are performed in order:
  1. Read state parameter values from eTPU DATA RAM
  2. Clear FUEL error
Parameters:
*p_fuel_instance - This is a pointer to the instance structure p_fuel_instance.
*p_fuel_states - This is a pointer to the return structure of states p_fuel_states.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 277 of file etpu_fuel.c.

References fuel_instance_t::cpba, fuel_states_t::error, FS_ETPU_FUEL_OFFSET_ERROR, FS_ETPU_FUEL_OFFSET_INJECTION_START_ANGLE_CPU, FS_ETPU_FUEL_OFFSET_INJECTION_TIME_APPLIED_CPU, fuel_states_t::injection_start_angle, and fuel_states_t::injection_time_applied.

uint32_t fs_etpu_fuel_init struct fuel_instance_t p_fuel_instance,
struct fuel_config_t p_fuel_config
 

This function initializes eTPU channels to run FUEL 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_fuel_instance - This is a pointer to the instance structure fuel_instance_t.
*p_fuel_config - This is a pointer to the structure of configuration parameters fuel_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 97 of file etpu_fuel.c.

References fuel_config_t::angle_normal_end, fuel_config_t::angle_offset_recalc, fuel_config_t::angle_stop, fuel_instance_t::chan_num, fuel_config_t::compensation_time, fuel_instance_t::cpba, fs_etpu_data_ram_start, FS_ETPU_FUEL_FUNCTION_NUMBER, FS_ETPU_FUEL_HSR_INIT, FS_ETPU_FUEL_NUM_PARMS, FS_ETPU_FUEL_OFFSET_ANGLE_NORMAL_END, FS_ETPU_FUEL_OFFSET_ANGLE_OFFSET_RECALC, FS_ETPU_FUEL_OFFSET_ANGLE_STOP, FS_ETPU_FUEL_OFFSET_COMPENSATION_TIME, FS_ETPU_FUEL_OFFSET_ERROR, FS_ETPU_FUEL_OFFSET_GENERATION_DISABLE, FS_ETPU_FUEL_OFFSET_INJECTION_START_ANGLE, FS_ETPU_FUEL_OFFSET_INJECTION_START_ANGLE_CPU, FS_ETPU_FUEL_OFFSET_INJECTION_TIME, FS_ETPU_FUEL_OFFSET_INJECTION_TIME_APPLIED, FS_ETPU_FUEL_OFFSET_INJECTION_TIME_APPLIED_CPU, FS_ETPU_FUEL_OFFSET_INJECTION_TIME_MINIMUM, FS_ETPU_FUEL_OFFSET_OFF_TIME_MINIMUM, FS_ETPU_FUEL_OFFSET_PULSE_END_TIME, FS_ETPU_FUEL_OFFSET_PULSE_START_TIME, FS_ETPU_FUEL_OFFSET_TDC_ANGLE, FS_ETPU_FUEL_OFFSET_TDC_ANGLE_ACTUAL, FS_ETPU_FUEL_TABLE_SELECT, fuel_config_t::generation_disable, fuel_config_t::injection_time, fuel_config_t::injection_time_minimum, fuel_config_t::off_time_minimum, fuel_instance_t::polarity, fuel_instance_t::priority, and fuel_instance_t::tdc_angle.

uint32_t fs_etpu_fuel_update_injection_time struct fuel_instance_t p_fuel_instance,
struct fuel_config_t p_fuel_config
 

This function updates the FUEL injection_time.

Note:
The following actions are performed in order:
  1. Check there is no pending HSR
  2. Write parameter value to eTPU DATA RAM
  3. Write HSR
Parameters:
*p_fuel_instance - This is a pointer to the instance structure inj_instance_t.
*p_fuel_config - This is a pointer to the structure of configuration parameters inj_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error.
  • FS_ETPU_ERROR_TIMING - The mode was not set because there is a HSR pending on the eTPU channel. It can be caused by a call of another API function which writes the HSR to the same channel shortly before this function call. Try to repeat the function call several microseconds later.

Definition at line 230 of file etpu_fuel.c.

References fuel_instance_t::chan_num, fuel_instance_t::cpba, FS_ETPU_FUEL_HSR_UPDATE, FS_ETPU_FUEL_OFFSET_INJECTION_TIME, and fuel_config_t::injection_time.


Variable Documentation

uint32_t fs_etpu_data_ram_ext
 

uint32_t fs_etpu_data_ram_start
 

Referenced by fs_etpu_fuel_init().