/**************************************************************************//**
 *
 *  \copyright  This software is the property of  Technologies. Any
 *              information contained in this doc should not be reproduced,
 *              or used, or disclosed without the written authorization from
 *               Technologies.
 *
 *  \brief      This is the source file to configurate the DCM module.
 *
 *  \file       bl_dcm_cfg.c
 *  \ingroup    communication_protocol_stack_module
 *  \author     
 *              
 *
 *  \version    5.2.0
 *  \date       19/06/2014
 *
 *  \par        Changelist
 *      Version  | Date       | Authors          | CR# | Descriptions
 *      -------- | ---------- | ---------------- | --- | ------------
 *      01.00.00 | 08/04/2010 | hewei.zhang      | N/A | Boot010001
 *      01.02.00 | 19/04/2010 | hewei.zhang      | N/A | Boot010003
 *      01.04.00 | 06/05/2010 | hewei.zhang      | N/A | Boot010005
 *      02.00.00 | 18/03/2011 | mingqing.tang    | N/A | Boot020001
 *      02.01.00 | 31/03/2011 | mingqing.tang    | N/A | Boot020002
 *      02.03.00 | 07/04/2011 | mingqing.tang    | N/A | Boot020004
 *      03.00.00 | 12/09/2011 | mingqing.tang    | N/A | Boot030001
 *      03.05.00 | 11/10/2011 | mingqing.tang    | N/A | Boot030006
 *      03.06.00 | 26/10/2011 | mingqing.tang    | N/A | Boot030007
 *      04.00.00 | 02/01/2012 | mingqing.tang    | N/A | Boot040001
 *      04.02.00 | 16/01/2012 | mingqing.tang    | N/A | Boot040003
 *      04.08.00 | 04/04/2012 | mingqing.tang    | N/A | Boot040009
 *      05.00.00 | 19/06/2013 | heli.zhang       | N/A | Boot050001
 *      05.01.00 | 27/03/2014 | mingqing.tang    | N/A | Boot050002
 *      05.02.00 | 19/06/2014 | mingqing.tang    | N/A | BootSpec050001
 *
 *****************************************************************************/
#include "bl_dcm_cfg.h"
#include "bl_adpt_uds_platform.h"

/*****************************************************************************
 *  QAC Suppression
 *****************************************************************************/
/*PRQA S 1257,1531,1533,3120,3211 EOF*/
/*
 * 1257:Suffixed integer constant implicitly converted to smaller integer type
 * on assignment.
 *
 * 1531:The object is referenced in only one translation unit.
 * g_DcmBuffer is a configurations.
 *
 * 1533:The object is only referenced by one function.
 * The g_DcmServiceList is a configurations.
 *
 * 3120:Hard-coded magic integer constant.
 * This is a only configuration.
 *
 * 3211:The global identifier is defined but not used.
 * The g_BootingCheckerList is used in the bl_booting.c file.
 *
 */

/*****************************************************************************
 *  Internal Macro Definitions
 *****************************************************************************/

/*****************************************************************************
 *  Internal Type Definitions
 *****************************************************************************/

/*****************************************************************************
 *  Internal Structure Definitions
 *****************************************************************************/

/*****************************************************************************
 *  Internal Function Declarations
 *****************************************************************************/

/*****************************************************************************
 *  Internal Variable Definitions
*****************************************************************************/
/**************************************************************************//**
 *  \details The dcmbuffer of saving rx and tx data.
 *****************************************************************************/
STATIC bl_Buffer_t gs_Buffer[DCM_BUFFER_SIZE];  //診斷時的多幀最大緩存  見 g_DcmBuffer.buffer 才是真正被調用的


/**************************************************************************//**
 *  \details The subfunction list of 0x10 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm10SubId[DCM_10SUBID_NUMBER] =
{
	{
		//id=1 //num=0  //minsize=0  //maxsize=2
		1, 0, DCM_10SUBID_MINLEN, DCM_10SUBID_MAXLEN,
		//flag=40000031f    //serviceList空  //header=空  //Callback
		DCM_10SUBID01_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1001
	},
	{
		//id=2 //num=0  //minsize=0  //maxsize=2
		2, 0, DCM_10SUBID_MINLEN, DCM_10SUBID_MAXLEN,
		//flag=400000316    //serviceList空  //header=空  //Callback
		DCM_10SUBID02_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1002
	},
	{
		//id=3 //num=0  //minsize=0  //maxsize=2
		3, 0, DCM_10SUBID_MINLEN, DCM_10SUBID_MAXLEN,
		//flag=40000031D    //serviceList空  //header=空  //Callback
		DCM_10SUBID03_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1003
	},
	{
		//id=3 //num=0  //minsize=0  //maxsize=2
		DCM_SESSION_SUPPLY_ID, 0, DCM_10SUBID_MINLEN, DCM_10SUBID_MAXLEN,
		//flag=40000031D    //serviceList空  //header=空  //Callback
		DCM_10SUBID04_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1004
	},
};

/**************************************************************************//**
 *  \details The subfunction list of 0x11 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm11SubId[DCM_11SUBID_NUMBER] =
{
	{
		//id=1 //num=0  //minsize=0  //maxsize=2
		1, 0, DCM_11SUBID_MINLEN, DCM_11SUBID_MAXLEN,
		//flag=0    //serviceList空  //header=空  //Callback
		DCM_11SUBID_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1101
	},
	{
		//id=1 //num=0  //minsize=0  //maxsize=2
		3, 0, DCM_11SUBID_MINLEN, DCM_11SUBID_MAXLEN,
		//flag=0    //serviceList空  //header=空  //Callback
		DCM_11SUBID_FLAG, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback1103
	}
};

/**************************************************************************//**
 *  \details The subfunction list of 0x27 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm27SubId[DCM_27SUBID_NUMBER] =
{
	{
		//id=0x11  //num=0  //minsize=2   //maxsize=2  //flag=0
		DCM_SA_SEED_REQ, 0, DCM_27SEED_MINLEN, 2, DCM_27SUBIDSEED_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackGetSeedForLevel1
	},
	{
		//id=0x12  //num=0  //minsize=6   //maxsize=6  //flag=0
		DCM_SA_KEY_RSP, 0, DCM_27KEY_MINLEN, DCM_27KEY_MAXLEN, DCM_27SUBIDKEY_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackVerifyKeyForLevel1
	},
	{
		//id=0x11  //num=0  //minsize=2   //maxsize=2  //flag=0
		DCM_SA_SEED_2_REQ, 0, DCM_27SEED_MINLEN, 2, DCM_27SUBIDSEED_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackGetSeedForLevel5
	},
	{
		//id=0x12  //num=0  //minsize=6   //maxsize=6  //flag=0
		DCM_SA_KEY_2_RSP, 0, DCM_27KEY_MINLEN, DCM_27KEY_MAXLEN, DCM_27SUBIDKEY_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackVerifyKeyForLevel5
	},
	{
		//id=0x11  //num=0  //minsize=2   //maxsize=2  //flag=0
		0x23, 0, DCM_27SEED_MINLEN, 2, DCM_27SUBIDSEED_FLAG_TEST,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackGetSeedForLevel23
	},
	{
		//id=0x12  //num=0  //minsize=6   //maxsize=6  //flag=0
		0x24, 0, DCM_27KEY_MINLEN, DCM_27KEY_MAXLEN, DCM_27SUBIDKEY_FLAG_TEST,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackVerifyKeyForLevel24
	},
};

/**************************************************************************//**
 *  \details The subfunction list of 0x28 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm28SubId[DCM_28SUBID_NUMBER] =
{
	{
		//id=0x3  //num=0  //minsize=0   //maxsize=0  //flag=0
		3, 0, DCM_28SUBID_MINLEN, 0, DCM_28SUBID03_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR,BL_NULL_PTR, &Adpt_UdsCallback28
	},
	{
		//id=0x1  //num=0  //minsize=0   //maxsize=0  //flag=0
		1, 0, DCM_28SUBID_MINLEN, 0, DCM_28SUBID01_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR,BL_NULL_PTR, &Adpt_UdsCallback28
	},
	{
		//id=0x0  //num=0  //minsize=0   //maxsize=0  //flag=0
		0, 0, DCM_28SUBID_MINLEN, 0, DCM_28SUBID00_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR,BL_NULL_PTR, &Adpt_UdsCallback28
	},
};

#define RID_CheckProgramCond	  (0x0203u) //FD02 CheckProgrammingPrecondition
#define RID_CheckProgramCheckSum  (0x0202u) //FD03 CheckRamBootSoftwarevalidityRoutine
#define RID_EraseFlashMemory      (0xFF00u) //FD00 EraseFlashMemoryRoutine
#define RID_CheckProgrammingDependency (0xFF01u) //FD01 Check Programming Dependency Routine, If only a single application software image is used, then always return TRUE

//#define DID_WR_Fingerprint	      (0xF198u)
#define DID_WR_Fingerprint	(0xF198u)   //原來寫入F198表示金手指
//#define DID_WR_PrgramDate       	(0x0202u)

#define DID_R_Fingerprint	(0xF198u)
#define DID_WR_ProgramDate	(0xF199u)
#define DID_R_ProgramDate	(0xF199u)
/**************************************************************************//**
 *  \details The data identifier list of 0x31 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm31Did[DCM_31DID_NUMBER] =
{
	{
		//id=0x0203          //num=0  //minsize=0   //maxsize=4   //flag=0x4000031c
		RID_CheckProgramCond, 0, DCM_31CONDITION_MINLEN, 4, DCM_31CONDITION_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackCheckProgramCond   //編程條件 好像沒有用到
	},
	{
		//id=ff00 擦除 num=0   //minsize=13   //maxsize=13   //flag=0x40000212
		RID_EraseFlashMemory, 0, DCM_31ERASE_MINLEN, 13, DCM_31ERASE_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackEraseMemory
	},
	{
		//id=0202 			//num=0     //minsize=8   //maxsize=8   //flag=0x40000212
		RID_CheckProgramCheckSum, 0, DCM_31CHECKSUM_MINLEN, 13, DCM_31CHECKSUM_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackCheckSum
	},
	{
		//id=FF01 			//num=0     //minsize=8   //maxsize=8   //flag=0x40000212
		RID_CheckProgrammingDependency, 0, DCM_31COMPAT_MINLEN, 4, DCM_31COMPAT_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackCheckCompatibility  //編程兼容性-依赖性
	},
#if(RTE_FUN_STAY_IN_BOOT == BL_FUN_ON)
	{
		//id=f518 			//num=0     //minsize=8   //maxsize=8   //flag=0x40000212
		0xF518u, 0, DCM_31STAYINBOOT_MINLEN, 4, DCM_31STAYINBOOT_FLAG,
		//serviceList空  //header=空  //Callback
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallbackStayInBoot
	},
#endif
};

/**************************************************************************//**
 *  \details The subfunction list of 0x31 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm31SubId[DCM_31SUBID_NUMBER] =
{
	{
		//id=1 		//num=5或4     //minsize=0   //maxsize=0   //flag=0
		1, DCM_31DID_NUMBER,DCM_31SUBID_MINLEN, 0u, DCM_31SUBID_FLAG,
		//serviceList  //header  //Callback
		gs_Dcm31Did, &g_DcmDidHeader, BL_NULL_PTR
	},
};

/**************************************************************************//**
 *  \details The subfunction list of 0x3E service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm3ESubId[DCM_3ESUBID_NUMBER] =
{
	{
		0, 0, 0, 0, 0, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback3E
	},
};

/**************************************************************************//**
 *  \details The subfunction list of 0x85 service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm85SubId[DCM_85SUBID_NUMBER] =
{
	{
		1, 0, 0, 0, 0, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback85
	},
	{
		2, 0, 0, 0, 0, BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallback85
	},
};


/**************************************************************************//**
 *  \details The subfunction list of 0x2E service.
 *****************************************************************************/
STATIC const bl_DcmService_t gs_Dcm2ESubId[DCM_2ESUBID_NUMBER] =
{
	{
		//id=F198 		//num=0     //minsize=19   //maxsize=19   //flag=0
		DID_WR_Fingerprint, 0, DCM_2EFINGERPRINT_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWriteFingerprint
	},
#if 1
	{
		//id=F199 		//num=0     //minsize=7   //maxsize=7   //flag=0
		DID_WR_ProgramDate, 0, DCM_2EPROGRAMDATE_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWriteProgrammingDate
	},
	{
		//id=F18C 		//num=0     //minsize=19   //maxsize=19   //flag=0
		0xf18c, 0, DCM_2E_F18C_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWrite_F18C
	},
	{
		//id=F190 		//num=0     //minsize=19   //maxsize=19   //flag=0
		0xf190, 0, DCM_2E_F190_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWrite_F190
	},
	{
		//id=FE02 		//num=0     //minsize=19   //maxsize=19   //flag=0
		0x01a0, 0, DCM_2E_01A0_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG_TEST, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWrite_01a0_manulifecount
	},
	{
		//id=FE02 		//num=0     //minsize=19   //maxsize=19   //flag=0
		0xFE01, 0, DCM_2E_FE01_MINLEN, DCM_2ESERVICE_MAXLEN, DCM_2EDID_FLAG_TEST, //DCM_2ESERVICE_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackWrite_fe01_backdoo_access_key
	},
#endif
};
STATIC const bl_DcmService_t gs_Dcm22SubId[DCM_22SUBID_NUMBER] =
{
	{//0
		0xf100U, 0, 2,6, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadPgmSuccCounter
	},
	{//1
		0x0201U, 0, 2,4, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadPgmAttmpCounter
	},
	{//2
		0xF180U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadBootSW_ID
	},
	{//3
		0xF181U, 0, 2,17, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_F181_vmapp_softid_ID
	},
	{//4
		0xF182U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_F182_ecu_calnum
	},
	{//5
		0xF186U, 0, 2,4, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadActiveSession
	},
	{//6
		0xF187U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadSparaPartNumber
	},
	{//7
		0xF188U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_F188_ECU_SW
	},
	{//8
		0xFE02U, 0, 2,4, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadfe02_count
	},
	{//9
		0xF18AU, 0, 2,8, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f18A_supplier
	},
	{//10
		0xF18BU, 0, 2,6, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f18B_ecu_manu_date
	},
	{
		0xF18CU, 0, 2,17, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f18C_ecu_sn
	},
	{
		0xF190U, 0, 2,19, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f190_vin
	},
	{
		0xF191U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f191_ecu_hw_num
	},
	{
		0xF192U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f192_hw_part_num
	},
	{
		0xF193U, 0, 2,19, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadECU_HW_Number
	},
	{
		0xF194U, 0, 2,19, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f194_ecu_sw_num
	},
	{
		0xF195U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f195_sw_version_num
	},
	{
		DID_WR_Fingerprint, 0, 2,23, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadFingerprint
	},
	{//19
		DID_WR_ProgramDate, 0, 2,7, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackReadProgrammingDate
	},
	{
		0xF19EU, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_f19E_odx_id
	},
	{
		0xF1F1U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_F1F1_ecu_cal_num,
	},
	{
		0xF1F2U, 0, 2,16, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_F1F2_boot_sw_id,
	},
	{
		0x01a0U, 0, 1,4, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_01a0_manulifecount,
	},
	{
		0xFE01U, 0, 2,4, DCM_22DID_FLAG,
		BL_NULL_PTR, BL_NULL_PTR, &Adpt_UdsCallBackRead_FE01_device_id,
	},
};

/**************************************************************************//**
 *  \details The all service list of dcm mudule.
 *****************************************************************************/
//這是總的DCM UDS 服務表
STATIC const bl_DcmService_t gs_DcmService[DCM_SERVICE_NUMBER] =
{
	{
		//id=0x0010  //num=3    //minSize=2
		0x0010u, DCM_10SUBID_NUMBER, DCM_10SERVICE_MINLEN,
		//maxsize=2             //flag=0         //serviceList
		DCM_10SERVICE_MAXLEN, DCM_10SERVICE_FLAG, gs_Dcm10SubId,
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x0011  //num=1    //minSize=2
		0x0011u, DCM_11SUBID_NUMBER, DCM_11SERVICE_MINLEN,
		//maxsize=2             //flag=4000031f         //serviceList
		DCM_11SERVICE_MAXLEN, DCM_11SERVICE_FLAG, gs_Dcm11SubId,\
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x0027  //num=2    //minSize=2
		0x0027u, DCM_27SUBID_NUMBER, DCM_27SERVICE_MINLEN,
		//maxsize=0             //flag=40000312         //serviceList
		DCM_27SERVICE_MAXLEN, DCM_27SERVICE_FLAG, gs_Dcm27SubId,
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x0028  //num=3    //minSize=3
		0x0028u, DCM_28SUBID_NUMBER, DCM_28SERVICE_MINLEN,
		//maxsize=3             //flag=4000031C         //serviceList
		DCM_28SERVICE_MAXLEN, DCM_28SERVICE_FLAG, gs_Dcm28SubId,
		//header
		&g_DcmSubIdHeader,BL_NULL_PTR
	},
	{
		//id=0x0031  //num=1    //minSize=4
		0x0031u, DCM_31SUBID_NUMBER, DCM_31SERVICE_MINLEN,
		//maxsize=0             //flag=0         //serviceList
		DCM_31SERVICE_MAXLEN, DCM_31SERVICE_FLAG, gs_Dcm31SubId,
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x0034  //num=0    //minSize=11
		0x0034u, DCM_34SUBID_NUMBER, DCM_34SERVICE_MINLEN,
		//maxsize=11             //flag=40000212         //serviceList
		DCM_34SERVICE_MAXLEN, DCM_34SERVICE_FLAG, BL_NULL_PTR,
		//header
		BL_NULL_PTR, &Adpt_UdsCallback34
	},
	{
		//id=0x0036  //num=0    //minSize=3
		0x0036u, DCM_36SUBID_NUMBER, DCM_36SERVICE_MINLEN,
		//maxsize=0             //flag=40000212         //serviceList
		DCM_36SERVICE_MAXLEN, DCM_36SERVICE_FLAG, BL_NULL_PTR,
		//header
		BL_NULL_PTR, &Adpt_UdsCallback36
	},
	{
		//id=0x0037  //num=0    //minSize=1
		0x0037u, DCM_37SUBID_NUMBER, DCM_37SERVICE_MINLEN,
		//maxsize=1             //flag=40000212         //serviceList
		DCM_37SERVICE_MAXLEN, DCM_37SERVICE_FLAG, BL_NULL_PTR,
		//header
		BL_NULL_PTR, &Adpt_UdsCallback37
	},
	{
		//id=0x003E  //num=1    //minSize=2
		0x003Eu, DCM_3ESUBID_NUMBER, DCM_3ESERVICE_MINLEN,
		//maxsize=2             //flag=4000031f         //serviceList
		DCM_3ESERVICE_MAXLEN, DCM_3ESERVICE_FLAG, gs_Dcm3ESubId,
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x0085  //num=2    //minSize=2
		0x0085u, DCM_85SUBID_NUMBER, DCM_85SERVICE_MINLEN,
		//maxsize=2             //flag=4000031C         //serviceList
		DCM_85SERVICE_MAXLEN, DCM_85SERVICE_FLAG, gs_Dcm85SubId,
		//header
		&g_DcmSubIdHeader, BL_NULL_PTR
	},
	{
		//id=0x002e  //num=2    //minSize=7
		0x002Eu, DCM_2ESUBID_NUMBER, DCM_2ESERVICE_MINLEN,
		//maxsize=19             //flag=40000212         //serviceList
		DCM_2ESERVICE_MAXLEN, DCM_2ESERVICE_FLAG, gs_Dcm2ESubId,
		//header
		&g_DcmDidHeader, BL_NULL_PTR
	},
	{
		//id=0x0022  //num=12    //minSize=3
		0x0022u, DCM_22SUBID_NUMBER, DCM_22SERVICE_MINLEN,
		//maxsize=3             //flag=4000031f         //serviceList
		DCM_22SERVICE_MAXLEN, DCM_22SERVICE_FLAG, gs_Dcm22SubId,
		//header
		&g_DcmDidHeader, BL_NULL_PTR
	},
	//g_DcmSubIdHeader
};

/*****************************************************************************
 *  External Variable Definitions
*****************************************************************************/
/**************************************************************************//**
 *  \details The dcmbuffer info, including recvSize, tranSize and so on.
 *****************************************************************************/
bl_DcmBuffer_t g_DcmBuffer =
{
	//status             //index //recvSize  //tranSize //totalSize  *b=實體uffer
	DCM_STATUS_BUFFER_UNLOCK, 0, 0, 0, DCM_BUFFER_SIZE, gs_Buffer,
};

const bl_DcmService_t g_DcmServiceList =
{
	0,   //id
	DCM_SERVICE_NUMBER,  //number
	0,  //minSize
	0,	//maxSize
	0,   //flag
	gs_DcmService,  //serviceList  -- 結構體 _tag_DcmService
	&g_DcmServiceHeader,  //header  -- 結構體 _tag_DcmServiceHeader
	BL_NULL_PTR
};

