
/**************************************************************** 
* WARNING: This file is automatically generated. DO NOT EDIT IT!
*
* COPYRIGHT (c) Freescale 2004-2014, All Rights Reserved
*
* FILE NAME: etpu_crank_auto.h
* ARCHITECTURE: eTPU2
*
* This file was generated by: etpuc_crank.c on Jun 30 2015 , 08:35:54
*
* This file provides an interface between eTPU code and CPU
* code. All references to the eTPU function should be made with
* information in this file. This allows only symbolic
* information to be referenced which allows the eTPU code to be
* optimized without effecting the CPU code.
*****************************************************************/
#ifndef _ETPU_CRANK_AUTO_H_
#define _ETPU_CRANK_AUTO_H_

/* Function Configuration Information */
#define FS_ETPU_CRANK_FUNCTION_NUMBER 1
#define FS_ETPU_CRANK_TABLE_SELECT 1
#define FS_ETPU_CRANK_NUM_PARMS 0x50


/* Host Service Request Definitions */
#define FS_ETPU_CRANK_HSR_INIT 7
#define FS_ETPU_CRANK_HSR_SET_SYNC 1

/* Function Mode Bit Definitions */
#define FS_ETPU_CRANK_FM0_USE_TRANS_RISING 1
#define FS_ETPU_CRANK_FM0_USE_TRANS_FALLING 0
#define FS_ETPU_CRANK_FM1_TOOTH_PERIODS_LOG_OFF (0)
#define FS_ETPU_CRANK_FM1_TOOTH_PERIODS_LOG_ON (1 << 1)

/* Parameter Definitions */
#define FS_ETPU_CRANK_OFFSET_BLANK_TIME  0x1
#define FS_ETPU_CRANK_OFFSET_TCR2_TICKS_PER_TOOTH  0x5
#define FS_ETPU_CRANK_OFFSET_TCR2_TICKS_PER_ADD_TOOTH 0x9
#define FS_ETPU_CRANK_OFFSET_LAST_TOOTH_TCR1_TIME  0xd
#define FS_ETPU_CRANK_OFFSET_LAST_TOOTH_PERIOD  0x11
#define FS_ETPU_CRANK_OFFSET_ADDITIONAL_TOOTH_PERIOD  0x15
#define FS_ETPU_CRANK_OFFSET_TCR2_ADJUSTMENT  0x19
#define FS_ETPU_CRANK_OFFSET_GAP_RATIO  0x1d
#define FS_ETPU_CRANK_OFFSET_WIN_RATIO_NORMAL  0x21
#define FS_ETPU_CRANK_OFFSET_WIN_RATIO_ACROSS_GAP  0x25
#define FS_ETPU_CRANK_OFFSET_WIN_RATIO_AFTER_GAP  0x29
#define FS_ETPU_CRANK_OFFSET_WIN_RATIO_AFTER_TIMEOUT  0x2d
#define FS_ETPU_CRANK_OFFSET_FIRST_TOOTH_TIMEOUT  0x31
#define FS_ETPU_CRANK_OFFSET_LINK_CAM  0x34
#define FS_ETPU_CRANK_OFFSET_LINK_1  0x38
#define FS_ETPU_CRANK_OFFSET_LINK_2  0x3c
#define FS_ETPU_CRANK_OFFSET_LINK_3  0x40
#define FS_ETPU_CRANK_OFFSET_LINK_4  0x44
#define FS_ETPU_CRANK_OFFSET_TEETH_TILL_GAP  0x0
#define FS_ETPU_CRANK_OFFSET_TEETH_IN_GAP  0x4
#define FS_ETPU_CRANK_OFFSET_MISSCNT_MASK  0x4c
#define FS_ETPU_CRANK_OFFSET_TEETH_PER_CYCLE  0x8
#define FS_ETPU_CRANK_OFFSET_TEETH_PER_SYNC  0xc
#define FS_ETPU_CRANK_OFFSET_TOOTH_COUNTER_GAP  0x10
#define FS_ETPU_CRANK_OFFSET_TOOTH_COUNTER_CYCLE  0x14
#define FS_ETPU_CRANK_OFFSET_BLANK_TEETH  0x18
#define FS_ETPU_CRANK_OFFSET_STATE  0x1c
#define FS_ETPU_CRANK_OFFSET_ERROR  0x20
#define FS_ETPU_CRANK_OFFSET_TOOTH_PERIOD_LOG  0x49

/* Globals definitions */
#define FS_ETPU_OFFSET_ENG_POS_STATE  0x20
#define FS_ETPU_OFFSET_ENG_CYCLE_TCR2_TICKS  0x25
#define FS_ETPU_OFFSET_ENG_CYCLE_TCR2_START  0x29

/* Errors */
#define FS_ETPU_CRANK_ERR_NO_ERROR  0
#define FS_ETPU_CRANK_ERR_INVALID_TRANS  1
#define FS_ETPU_CRANK_ERR_INVALID_MATCH  2
#define FS_ETPU_CRANK_ERR_TIMEOUT  4
#define FS_ETPU_CRANK_ERR_STALL  8
#define FS_ETPU_CRANK_ERR_INTERNAL  16
#define FS_ETPU_CRANK_ERR_TIMEOUT_BEFORE_GAP  32
#define FS_ETPU_CRANK_ERR_TIMEOUT_AFTER_GAP  64
#define FS_ETPU_CRANK_ERR_TOOTH_IN_GAP  128
#define FS_ETPU_CRANK_ERR_ADD_TOOTH_NOT_FOUND 128

/* Crank State values */
#define FS_ETPU_CRANK_SEEK  0
#define FS_ETPU_CRANK_BLANK_TIME  1
#define FS_ETPU_CRANK_BLANK_TEETH  2
#define FS_ETPU_CRANK_FIRST_TRANS  3
#define FS_ETPU_CRANK_SECOND_TRANS  4
#define FS_ETPU_CRANK_TEST_POSSIBLE_GAP  5
#define FS_ETPU_CRANK_VERIFY_GAP  6
#define FS_ETPU_CRANK_COUNTING  7
#define FS_ETPU_CRANK_COUNTING_TIMEOUT  8
#define FS_ETPU_CRANK_TOOTH_BEFORE_GAP  9
#define FS_ETPU_CRANK_TOOTH_BEFORE_GAP_NOT_HRM  10
#define FS_ETPU_CRANK_ADDITIONAL_TOOTH  10
#define FS_ETPU_CRANK_TOOTH_AFTER_GAP  11

/* Global Engine Position State values */
#define FS_ETPU_ENG_POS_SEEK  0
#define FS_ETPU_ENG_POS_FIRST_HALF_SYNC  1
#define FS_ETPU_ENG_POS_PRE_FULL_SYNC  2
#define FS_ETPU_ENG_POS_FULL_SYNC  3

#endif
