uds_includes.h 3.44 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
/*
 * includes.h
 *
 *  Created on: 2014-7-31
 *      Author: qitiancun
 */

#ifndef _UDS_INCLUDES_H_
#define _UDS_INCLUDES_H_
#include "TYW_stdint.h"
/*
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
*/
#define MaxBuff 266
typedef enum
{
    STATE0 = 1,
    N_OK_2,
    CTS,
    WAIT,
    OVFLW,
    N_TIMEOUT_Bs_6,
    N_ERROR_7,
    N_INVALID_FS_8,
    N_WRONG_SN_9
} Enum_Result;

typedef enum
{
    empoty,
    full
} TransSt;
typedef struct
{
    uint16_t Identifier; //Fun--PGN--
    uint8_t DLC;
    uint8_t Data[8];
    TransSt TransferStatus;
} _LinkData;

typedef struct
{
    struct
    {
        uint16_t pos;
        uint16_t Length;
        uint16_t N_FC_Num;
        uint16_t N_RecSN_L;
        uint8_t N_SendSN;
        uint8_t N_BS_CNT;
        uint8_t N_BS;
        uint8_t N_SA;
        uint8_t N_TA;
        uint8_t N_PCI;
        uint8_t N_SID;
    } ind;
} _N_US_Data_FF;

typedef struct
{
    struct
    {
        uint16_t N_TAtype;
        uint16_t Length;
        uint8_t N_SA;
        uint8_t N_TA;
        uint8_t N_AE;
        uint8_t N_PCI;
        uint8_t MsgData[8];
        Enum_Result N_Result;
    } ind;
} _N_USSFData;


typedef struct
{
    struct
    {
        uint16_t N_TAtype; //PGN  55808--0xDA00
        uint16_t Length;
        uint8_t N_SA;
        uint8_t N_TA;
        uint8_t N_AE;
        uint8_t N_PCI;
        uint8_t MsgData[MaxBuff];
        Enum_Result N_Result;
    } ind;
} _N_USData;

typedef struct
{
    struct
    {
        uint8_t len;
        uint8_t MsgData[8];
        uint8_t N_Result;
    } ind;
} _N_RSPData;


typedef union
{
    struct
    {
        uint8_t SubFunBit0_6 : 7;
        uint8_t SubFunBit7_7 : 1;
    } SubBits;
    uint8_t SubData;
} _SubFun;


typedef struct
{
    uint8_t SessionType;
    uint8_t AccessLock;
    uint8_t AccessCount;
    uint8_t key[4];
    uint8_t SubFunction;
    uint8_t w27_Sequence;
    uint8_t A5_Sequence;
    uint8_t DTCSettingType;
    uint8_t tDiagStart;
    uint8_t tDiagKL30ONStart;
    uint8_t N_STmin_0;
    uint8_t N_REV_MAX_BS;
    uint8_t CommType;
    uint8_t CommCtl;
    uint8_t DTCByStatusMask;
} _DiagnoCtl;

typedef struct
{
    uint16_t N_TAtype; //PGN--55808--DA00
    uint8_t FrameErr;
    uint8_t RespSerId;
} _ErrorFrame;

typedef struct
{
    uint32_t OverBsTime;
    uint32_t BsTime;

    uint32_t OverSTminTime;
    uint32_t STminTime;

    uint32_t OverCrTime;
    uint32_t CrTime;

    uint32_t OverSessionTime;
    uint32_t SessionTime;

    uint32_t OverSequenceTime;
    uint32_t SequenceTime;

    uint32_t OverUnlockTime;
    uint32_t UnlockTime;

    uint8_t TT_BsEnable;

    uint8_t TT_STminEnable;

    uint8_t TT_CrEnable;

    uint8_t TT_SessionEnable;

    uint8_t TT_SequenceEnable;

    uint8_t TT_UnlockEnable;

    uint8_t E2_WriteTime;

} _DiagClock;
typedef union
{
    struct
    {
        uint32_t StructDTC[25];
    } SubDTC;
    uint8_t UnionDTC[100];
} _DiagReciveDTC;
typedef struct
{
    uint8_t CoolantTemp[20];
    uint8_t MilLamp;
} _DiagReciveGaugePara;


#include "UDS_Def.h"
#include "UDS_CFG.h"
#include "TP_Layer.h"
#include "Link_Layer.h"
#include "app_ServiceProc.h"
#include "app_Service.h"
extern _DiagReciveDTC  DiagReciveDTC   ;
extern _DiagReciveGaugePara DiagReciveGaugePara;
#endif /* _UDS_INCLUDES_H_ */