![]() |
00001 /******************************************************************************* 00002 * 00003 * Freescale Semiconductor Inc. 00004 * (c) Copyright 2004-2014 Freescale Semiconductor, Inc. 00005 * ALL RIGHTS RESERVED. 00006 * 00007 ****************************************************************************//*! 00008 * 00009 * @file etpu_fuel.h 00010 * 00011 * @author Milan Brejl [r54529] 00012 * 00013 * @version 1.0 00014 * 00015 * @date 17-Mar-2014 00016 * 00017 * @brief This file contains useful macros and prototypes for FUEL API. 00018 * 00019 *******************************************************************************/ 00020 #ifndef _ETPU_FUEL_H_ 00021 #define _ETPU_FUEL_H_ 00022 00023 /******************************************************************************* 00024 * Includes 00025 *******************************************************************************/ 00026 #include "etpu_util.h" /* 24-bit types */ 00027 #include "etpu_fuel_auto.h" /* auto generated header file */ 00028 00029 /******************************************************************************* 00030 * Definitions 00031 *******************************************************************************/ 00032 00033 /******************************************************************************* 00034 * Type Definitions 00035 *******************************************************************************/ 00036 /** A structure to represent an instance of FUEL. 00037 * It includes static FUEL initialization items. */ 00038 struct fuel_instance_t 00039 { 00040 const uint8_t chan_num; /**< Channel number of the FUEL channel. */ 00041 const uint8_t priority; /**< Channel priority for the FUEL channel. */ 00042 const uint8_t polarity; /**< FUEL polarity. It can one any of: 00043 - @ref FS_ETPU_FUEL_FM0_ACTIVE_HIGH - active output signal state is high 00044 - @ref FS_ETPU_FUEL_FM0_ACTIVE_LOW - active output signal state is low */ 00045 const uint24_t tdc_angle; /**< The cylinder Top Dead Center as a number 00046 of TCR2 angle ticks relative to zero engine angle, in a range corresponding 00047 to 0-720 degrees. */ 00048 uint32_t *cpba; /**< Channel parameter base address. 00049 Set cpba = 0 to use automatic allocation of eTPU DATA RAM for FUEL channel 00050 parameters using the eTPU utility function fs_etpu_malloc (recommanded), 00051 or assign the cpba manually by an address where the FUEL channel parameter 00052 space will start from, e.g. 0xC3FC8100. */ 00053 }; 00054 00055 /** A structure to represent a configuration of FUEL. 00056 * It includes FUEL configuration items which can be changed in run-time. */ 00057 struct fuel_config_t 00058 { 00059 int24_t angle_normal_end; /**< The tdc_angle-relative normal end angle as a 00060 number of TCR2 ticks. Positive values precede the TDC, negative go after. 00061 The injection start angle is calculated, based on the currecnt engine speed, 00062 so that the injection ends at the normal_end_angle. */ 00063 int24_t angle_stop; /**< The tdc_angle-relative injection latest stop 00064 angle, or drop-dead-angle, as a number of TCR2 ticks. Positive values 00065 precede the TDC, negative go after. 00066 If the engine accelerates, the need is to keep the injection_time, so the 00067 injectind ends later than at the normal_end_angle, but not later than the 00068 stop_angle. If na injection is stopped by the stop_angle, the error flag 00069 @ref FS_ETPU_FUEL_ERROR_STOP_ANGLE_APPLIED is set. */ 00070 int24_t angle_offset_recalc; /**< The recalculation offset angle as a 00071 number of TCR2 ticks. 00072 At the stop_angle of one injection the start_angle of the next injection is 00073 calculated according to the actual engine speed. The calculation is repeated 00074 once again in order to adjust to a speed change at a defined angular 00075 position before the originaly calculated start_angle. This position is given 00076 by angle_offset_recalc. */ 00077 uint24_t injection_time; /**< A TCR1 time determining the fuel injection 00078 pulse width, corresponding to the amount of fuel injected by one fuel 00079 injector in each engine cycle. */ 00080 uint24_t compensation_time; /**< A TCR1 time which is added to each fuel 00081 injection pulse width in order to compensate the valve openning and closing 00082 time. */ 00083 uint24_t injection_time_minimum; /**< A TCR1 minimum fuel injection pulse 00084 width. Pulses shorter than injection_time_minimum are not generated. */ 00085 uint24_t off_time_minimum; /**< A TCR1 minimum time between fuel injection 00086 pulses. In case there is an additional injection pulse generated because of 00087 injection_time update after the main pulse ended, the additional pulse does 00088 not start earlier than off_time_minimum after the main pulse end. This also 00089 applies to next additional pulses. */ 00090 uint8_t generation_disable; /**< This parameter disables/enables 00091 the generation of output pulses. It can be assigned one of the values: 00092 - @ref FS_ETPU_FUEL_GENERATION_ALLOWED 00093 - @ref FS_ETPU_FUEL_GENERATION_DISABLED 00094 FS_ETPU_FUEL_GENERATION_DISABLED switches the injection pulse generation 00095 off. Switching off can also be done by setting the injection_time = 0, but 00096 that would shorten an injection pulse which is currently in progress. 00097 Instead, FS_ETPU_FUEL_GENERATION_DISABLED can switch off at any time, but 00098 a pulse which has already been started will be correctly finished. 00099 FS_ETPU_FUEL_GENERATION_ALLOWED switches the injection pulse generation 00100 on. */ 00101 }; 00102 00103 /** A structure to represent states of FUEL. */ 00104 struct fuel_states_t 00105 { 00106 uint8_t error; /**< This is the error status of FUEL. It may 00107 include the following error flags: 00108 - @ref FS_ETPU_FUEL_ERROR_STOP_ANGLE_APPLIED 00109 - @ref FS_ETPU_FUEL_ERROR_MINIMUM_INJ_TIME_APPLIED 00110 The eTPU sets the error flags, the CPU clears them after reading. */ 00111 uint24_t injection_time_applied; /**< This is the applied injection 00112 time of the last injection. The value corresponds to commanded 00113 injection_time, but it may slightly differ in case of rapid acceleration or 00114 late call of @ref fs_etpu_fuel_update_injection_time(). */ 00115 int24_t injection_start_angle; /**< This is the last injection 00116 tdc_angle-relative start angle as a number of TCR2 ticks. */ 00117 }; 00118 00119 /******************************************************************************* 00120 * Function prototypes 00121 *******************************************************************************/ 00122 /* Initialize */ 00123 uint32_t fs_etpu_fuel_init( 00124 struct fuel_instance_t *p_fuel_instance, 00125 struct fuel_config_t *p_fuel_config); 00126 00127 /* Change configuration */ 00128 uint32_t fs_etpu_fuel_config( 00129 struct fuel_instance_t *p_fuel_instance, 00130 struct fuel_config_t *p_fuel_config); 00131 00132 /* Update injection time */ 00133 uint32_t fs_etpu_fuel_update_injection_time( 00134 struct fuel_instance_t *p_fuel_instance, 00135 struct fuel_config_t *p_fuel_config); 00136 00137 /* Get states */ 00138 uint32_t fs_etpu_fuel_get_states( 00139 struct fuel_instance_t *p_fuel_instance, 00140 struct fuel_states_t *p_fuel_states); 00141 00142 #endif /* _ETPU_FUEL_H_ */ 00143 /******************************************************************************* 00144 * 00145 * Copyright: 00146 * Freescale Semiconductor, INC. All Rights Reserved. 00147 * You are hereby granted a copyright license to use, modify, and 00148 * distribute the SOFTWARE so long as this entire notice is 00149 * retained without alteration in any modified and/or redistributed 00150 * versions, and that such modified versions are clearly identified 00151 * as such. No licenses are granted by implication, estoppel or 00152 * otherwise under any patents or trademarks of Freescale 00153 * Semiconductor, Inc. This software is provided on an "AS IS" 00154 * basis and without warranty. 00155 * 00156 * To the maximum extent permitted by applicable law, Freescale 00157 * Semiconductor DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 00158 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 00159 * PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH 00160 * REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) 00161 * AND ANY ACCOMPANYING WRITTEN MATERIALS. 00162 * 00163 * To the maximum extent permitted by applicable law, IN NO EVENT 00164 * SHALL Freescale Semiconductor BE LIABLE FOR ANY DAMAGES WHATSOEVER 00165 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 00166 * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER 00167 * PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 00168 * 00169 * Freescale Semiconductor assumes no responsibility for the 00170 * maintenance and support of this software 00171 ******************************************************************************/ 00172 /******************************************************************************* 00173 * 00174 * REVISION HISTORY: 00175 * 00176 * FILE OWNER: Milan Brejl [r54529] 00177 * 00178 * Revision 1.0 2014/03/17 r54529 00179 * Minor comment and formating improvements. 00180 * Ready for eTPU Engine Control Library release 1.0. 00181 * 00182 * Revision 0.2 2013/09/05 r54529 00183 * Addition of generation_disable. 00184 * 00185 * Revision 0.1 2013/08/28 r54529 00186 * Initial version of file. 00187 * 00188 ******************************************************************************/
Generated by ![]() |
© Freescale Semiconductor Inc. 2004 - 2012. All Rights Reserved. |