![]() |
00001 /******************************************************************************* 00002 * 00003 * Freescale Semiconductor Inc. 00004 * (c) Copyright 2004-2014 Freescale Semiconductor, Inc. 00005 * ALL RIGHTS RESERVED. 00006 * 00007 ****************************************************************************//*! 00008 * 00009 * @file etpu_tg.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 TG API. 00018 * 00019 *******************************************************************************/ 00020 #ifndef _ETPU_TG_H_ 00021 #define _ETPU_TG_H_ 00022 00023 /******************************************************************************* 00024 * Includes 00025 *******************************************************************************/ 00026 #include "etpu_util.h" /* 24-bit types */ 00027 #include "etpu_tg_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 TG. 00037 * It includes static TG initialization items. */ 00038 struct tg_instance_t 00039 { 00040 const uint8_t chan_num_crank; /**< Channel number of the TG Crank channel. */ 00041 const uint8_t chan_num_cam; /**< Channel number of the TG Cam channel. */ 00042 const uint8_t priority; /**< Channel priority for the TG channel. */ 00043 const uint8_t polarity_crank; /**< Initial Crank output polarity. 00044 It can be one of: 00045 - @ref FS_ETPU_TG_FM0_POLARITY_LOW 00046 - @ref FS_ETPU_TG_FM0_POLARITY_HIGH */ 00047 const uint8_t polarity_cam; /**< Initial cam output polarity. 00048 It can be one of: 00049 - @ref FS_ETPU_TG_FM0_POLARITY_LOW 00050 - @ref FS_ETPU_TG_FM0_POLARITY_HIGH */ 00051 const uint8_t teeth_till_gap; /**< A number of physical teeth between 2 gaps. 00052 This is the number of physical teeth on the crank wheel divided by 00053 the number of (equally spaced) gaps on the wheel. */ 00054 const uint8_t teeth_in_gap; /**< A number of missing teeth in one gap. 00055 This should be assigned a value of 1, 2 or 3. */ 00056 const uint8_t teeth_per_cycle; /**< A number of teeth (including missing 00057 teeth in gap) per an engine cycle (720 degrees). It must be a multiple of 00058 (teeth_till_gap + teeth_in_gap). */ 00059 const uint8_t cam_edge_count; /**< The count of Cam edges within an engine 00060 cycle.*/ 00061 const uint8_t *p_cam_edge_tooth; /**< Pointer to the first item of an array 00062 of tooth numbers where the cam signal toggles */ 00063 uint32_t *cpba; /**< Channel parameter base address. 00064 Set cpba = 0 to use automatic allocation of eTPU DATA RAM for TG channel 00065 parameters using the eTPU utility function fs_etpu_malloc (recommanded), 00066 or assign the cpba manually by an address where the TG channel parameter 00067 space will start from, e.g. 0xC3FC8100. */ 00068 uint8_t *cpba8_cam_edge_tooth; /**< Base address of the array of tooth 00069 numbers where the cam signal toggles in eTPU DATA RAM. 00070 Set cpba_cam_edge_tooth = 0 to use automatic allocation of the 00071 eTPU DATA RAM space corresponding to the cam_edge_count value, 00072 using the eTPU utility function fs_etpu_malloc (recommanded), 00073 or assign the cpba_injections manually by an address, e.g. 0xC3FC8100. */ 00074 }; 00075 00076 /** A structure to represent a configuration of TG. 00077 * It includes TG configuration items which can be changed in 00078 * run-time. */ 00079 struct tg_config_t 00080 { 00081 int24_t tooth_period_target; /**< TG target Crank tooth period 00082 as a number of TCR1 ticks. */ 00083 fract24_t accel_ratio; /**< A signed fractional value 00084 (values 0 to 0x7FFFFF corresponds to 0 - 1.0) defining an exponencial 00085 acceleration/deceleration profile. On each tooth, the tooth_period_actual 00086 is updated by: 00087 accel_ratio * (tooth_period_target - tooth_period_actual) */ 00088 uint8_t generation_disable; /**< This parameter disables/enables 00089 the generation of crank output signal. It can be assigned one of the values: 00090 - @ref FS_ETPU_TG_GENERATION_ALLOWED 00091 - @ref FS_ETPU_TG_GENERATION_DISABLED */ 00092 }; 00093 00094 /** A structure to represent internal states of TG. */ 00095 struct tg_states_t 00096 { 00097 uint8_t tooth_counter_cycle; /**< This is the actual value of the tooth 00098 counter which counts from 1 to teeth_per_cycle. */ 00099 int24_t tooth_period_actual; /**< TG actual Crank tooth period 00100 as a number of TCR1 ticks. */ 00101 }; 00102 00103 /******************************************************************************* 00104 * Function prototypes 00105 *******************************************************************************/ 00106 /* Initialize */ 00107 uint32_t fs_etpu_tg_init( 00108 struct tg_instance_t *p_tg_instance, 00109 struct tg_config_t *p_tg_config); 00110 00111 /* Change configuration */ 00112 uint32_t fs_etpu_tg_config( 00113 struct tg_instance_t *p_tg_instance, 00114 struct tg_config_t *p_tg_config); 00115 00116 /* Get states */ 00117 uint32_t fs_etpu_tg_get_states( 00118 struct tg_instance_t *p_tg_instance, 00119 struct tg_states_t *p_tg_states); 00120 00121 00122 #endif /* _ETPU_TG_H_ */ 00123 /******************************************************************************* 00124 * 00125 * Copyright: 00126 * Freescale Semiconductor, INC. All Rights Reserved. 00127 * You are hereby granted a copyright license to use, modify, and 00128 * distribute the SOFTWARE so long as this entire notice is 00129 * retained without alteration in any modified and/or redistributed 00130 * versions, and that such modified versions are clearly identified 00131 * as such. No licenses are granted by implication, estoppel or 00132 * otherwise under any patents or trademarks of Freescale 00133 * Semiconductor, Inc. This software is provided on an "AS IS" 00134 * basis and without warranty. 00135 * 00136 * To the maximum extent permitted by applicable law, Freescale 00137 * Semiconductor DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 00138 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 00139 * PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH 00140 * REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) 00141 * AND ANY ACCOMPANYING WRITTEN MATERIALS. 00142 * 00143 * To the maximum extent permitted by applicable law, IN NO EVENT 00144 * SHALL Freescale Semiconductor BE LIABLE FOR ANY DAMAGES WHATSOEVER 00145 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 00146 * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER 00147 * PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. 00148 * 00149 * Freescale Semiconductor assumes no responsibility for the 00150 * maintenance and support of this software 00151 ******************************************************************************/ 00152 /******************************************************************************* 00153 * 00154 * REVISION HISTORY: 00155 * 00156 * FILE OWNER: Milan Brejl [r54529] 00157 * 00158 * Revision 1.0 2014/03/17 r54529 00159 * Minor comment and formating improvements. 00160 * Ready for eTPU Engine Control Library release 1.0. 00161 * 00162 * Revision 0.4 2013/10/22 r54529 00163 * generation_disable switch added. 00164 * 00165 * Revision 0.3 2013/07/24 r54529 00166 * Separate initial polarity for Crank and Cam. 00167 * 00168 * Revision 0.2 2013/06/20 r54529 00169 * Acceleration/deceleration added. 00170 * 00171 * Revision 0.1 2012/12/28 r54529 00172 * Initial version of file. 00173 ******************************************************************************/
Generated by ![]() |
© Freescale Semiconductor Inc. 2004 - 2012. All Rights Reserved. |