# ifndef _COMMON_DEF_FOR_A2L_
# define _COMMON_DEF_FOR_A2L_
# include <list>
# include <stdio.h>
# include <stdint.h>
enum A2L_DATA_TYPE {
A2L_DATA_TYPE_UBYTE = 0 , // 1 byte unsigned integer
A2L_DATA_TYPE_SBYTE , // 1 byte signed integer
A2L_DATA_TYPE_UWORD , // 2 byte unsigned integer
A2L_DATA_TYPE_SWORD , // 2 byte signed integer
A2L_DATA_TYPE_ULONG , // 4 byte unsigned integer
A2L_DATA_TYPE_SLONG , // 4 byte signed integer
A2L_DATA_TYPE_UINT64 , // 8 byte unsigned integer
A2L_DATA_TYPE_INT64 , // 8 byte signed integer
A2L_DATA_TYPE_FLOAT16_IEEE , // 4 byte(32 bit) floating point IEEE format
A2L_DATA_TYPE_FLOAT32_IEEE , // 4 byte(32 bit) floating point IEEE format
A2L_DATA_TYPE_FLOAT64_IEEE , // 8 byte(64 bit) floating point IEEE format
A2L_DATA_TYPE_FLOAT32_TASKING // 4 byte(32 bit) floating point tasking format
} ;
enum A2L_BYTE_ORDER_MSB_TYPE {
BYTE_ORDER_MSB_LAST = 0 ,
BYTE_ORDER_MSB_FIRST = 1
} ;
enum A2L_ADDRESS_GRANULARITY_TYPE {
ADDRESS_GRANULARITY_BYTE = 1 ,
ADDRESS_GRANULARITY_WORD = 2 ,
ADDRESS_GRANULARITY_DWORD = 4
} ;
enum A2L_OPTIONAL_COMMAND_TYPE {
GET_COMM_MODE_INFO = 0xFB ,
GET_ID = 0xFA ,
SET_REQUEST = 0xF9 ,
GET_SEED = 0xF8 ,
UNLOCK = 0xF7 ,
SET_MTA = 0xF6 ,
UPLOAD = 0xF5 ,
SHORT_UPLOAD = 0xF4 ,
BUILD_CHECKSUM = 0xF3 ,
TRANSPORT_LAYER_CMD = 0xF2 ,
USER_CMD = 0xF1 ,
DOWNLOAD = 0xF0 ,
DOWNLOAD_NEXT = 0xEF ,
DOWNLOAD_MAX = 0xEE ,
SHORT_DOWNLOAD = 0xED ,
MODIFY_BITS = 0xEC ,
SET_CAL_PAGE = 0xEB ,
GET_CAL_PAGE = 0xEA ,
GET_PAG_PROCESSOR_INFO = 0xE9 ,
GET_SEGMENT_INFO = 0xE8 ,
GET_PAGE_INFO = 0xE7 ,
SET_SEGMENT_MODE = 0xE6 ,
GET_SEGMENT_MODE = 0xE5 ,
COPY_CAL_PAGE = 0xE4 ,
CLEAR_DAQ_LIST = 0xE3 ,
SET_DAQ_PTR = 0xE2 ,
WRITE_DAQ = 0xE1 ,
SET_DAQ_LIST_MODE = 0xE0 ,
GET_DAQ_LIST_MODE = 0xDF ,
START_STOP_DAQ_LIST = 0xDE ,
START_STOP_SYNCH = 0xDD ,
GET_DAQ_CLOCK = 0xDC ,
READ_DAQ = 0xDB ,
GET_DAQ_PROCESSOR_INFO = 0xDA ,
GET_DAQ_RESOLUTION_INFO = 0xD9 ,
GET_DAQ_LIST_INFO = 0xD8 ,
GET_DAQ_EVENT_INFO = 0xD7 ,
FREE_DAQ = 0xD6 ,
ALLOC_DAQ = 0xD5 ,
ALLOC_ODT = 0xD4 ,
ALLOC_ODT_ENTRY = 0xD3 ,
PROGRAM_START = 0xD2 ,
PROGRAM_CLEAR = 0xD1 ,
PROGRAM = 0xD0 ,
PROGRAM_RESET = 0xCF ,
GET_PGM_PROCESSOR_INFO = 0xCE ,
GET_SECTOR_INFO = 0xCD ,
PROGRAM_PREPARE = 0xCC ,
PROGRAM_FORMAT = 0xCB ,
PROGRAM_NEXT = 0xCA ,
PROGRAM_MAX = 0xC9 ,
PROGRAM_VERIFY = 0xC8 ,
WRITE_DAQ_MULTIPLE = 0xC7
} ;
enum A2L_DAQ_MODE_TYPE {
STATIC = 0 ,
DYNAMIC = 1
} ;
enum A2L_DAQ_OPTIMISATION_TYPE {
OPTIMISATION_TYPE_DEFAULT = 0 ,
OPTIMISATION_TYPE_ODT_TYPE_16 = 1 ,
OPTIMISATION_TYPE_ODT_TYPE_32 = 2 ,
OPTIMISATION_TYPE_ODT_TYPE_64 = 3 ,
OPTIMISATION_TYPE_ODT_TYPE_ALIGNMENT = 4 ,
OPTIMISATION_TYPE_MAX_ENTRY_SIZE = 5
} ;
enum A2L_DAQ_ADDRESS_EXTENSION {
ADDRESS_EXTENSION_FREE = 0 ,
ADDRESS_EXTENSION_ODT = 1 ,
ADDRESS_EXTENSION_DAQ = 3 ,
} ;
enum A2L_DAQ_IDENTIFICATION_FIELD_TYPE {
IDENTIFICATION_FIELD_TYPE_ABSOLUTE = 0 ,
IDENTIFICATION_FIELD_TYPE_RELATIVE_BYTE = 1 ,
IDENTIFICATION_FIELD_TYPE_RELATIVE_WORD = 2 ,
IDENTIFICATION_FIELD_TYPE_RELATIVE_WORD_ALIGNED = 3
} ;
enum A2L_DAQ_GRANULARITY_ODT_ENTRY_SIZE {
GRANULARITY_ODT_ENTRY_SIZE_DAQ_BYTE = 1 ,
GRANULARITY_ODT_ENTRY_SIZE_DAQ_WORD = 2 ,
GRANULARITY_ODT_ENTRY_SIZE_DAQ_DWORD = 4 ,
GRANULARITY_ODT_ENTRY_SIZE_DAQ_DLONG = 8
} ;
enum A2L_OverloadIndication {
NO_OVERLOAD_INDICATION = 0 ,
OVERLOAD_INDICATION_PID = 1 ,
OVERLOAD_INDICATION_EVENT = 2
} ;
enum A2L_GranularityOdtEntrySizeStim {
GRANULARITY_ODT_ENTRY_SIZE_STIM_BYTE = 1 ,
GRANULARITY_ODT_ENTRY_SIZE_STIM_WORD = 2 ,
GRANULARITY_ODT_ENTRY_SIZE_STIM_DWORD = 4 ,
GRANULARITY_ODT_ENTRY_SIZE_STIM_DLONG = 8
} ;
enum A2L_TimestampSupportedSize {
NO_TIME_STAMP = 0 ,
SIZE_BYTE = 1 ,
SIZE_WORD = 2 ,
SIZE_DWORD = 4
} ;
enum A2L_TimestampSupportedUnit {
UNIT_1NS = 0 ,
UNIT_10NS = 1 ,
UNIT_100NS = 2 ,
UNIT_1US = 3 ,
UNIT_10US = 4 ,
UNIT_100US = 5 ,
UNIT_1MS = 6 ,
UNIT_10MS = 7 ,
UNIT_100MS = 8 ,
UNIT_1S = 9
} ;
enum A2L_DaqListType {
LIST_DAQ = 1 ,
LIST_STIM = 2 ,
LIST_DAQ_STIM = 3
} ;
enum A2L_DaqEventType {
EVENT_DAQ = 1 ,
EVENT_STIM = 2 ,
EVENT_DAQ_STIM = 3
} ;
enum A2L_PGMMode {
PGM_MODE_ABSOLUTE = 1 ,
PGM_MODE_FUNCTIONAL = 2 ,
PGM_MODE_ABSOLUTE_AND_FUNCTIONAL = 3
} ;
enum A2L_CAN_SAMPLE_RATE {
RATE_SINGLE = 1 ,
RATE_TRIPLE = 3
} ;
enum A2L_CAN_SYNC_EDGE {
EDGE_SINGLE = 1 ,
EDGE_DUAL = 2
} ;
enum A2L_TRANSCEIVER_DELAY_COMPENSATION {
COMPENSATION_OFF = 0 ,
COMPENSATION_ON = 1
} ;
enum A2L_TAB_CONVERSION_TYPE {
IDENTICAL = 0 ,
FORM , //- formula as specified in the Formula property.
LINEAR , // 20260223 compumethod 일단 추가함 ax + b, coeffs_linear 값 가지는듯
RAT_FUNC , //- fractional rational function f(x) = (axx + bx + c) / (dxx + ex + f), where coefficients 'a' through 'f' are specified properties.
TAB_INTP , // - table with interpolation.
TAB_NOINTP , //- table without interpolation.
TAB_VERB , //- verbal conversion table.
UNKNOWN
} ;
enum A2L_CHRACTERISTICS_TYPE {
ASCII = 0 ,
CURVE , // - an array of values with 1 axis.
MAP , // - a table of values with 2 axes.
CUBOID ,
CUBE_4 ,
CUBE_5 ,
VAL_BLK ,
VALUE // - a single value with no axis.
} ;
enum class A2L_IndexMode {
ALTERNATE_CURVES = 0 ,
ALTERNATE_WITH_X ,
ALTERNATE_WITH_Y ,
COLUMN_DIR ,
ROW_DIR ,
UNKNOWN
} ;
enum class A2L_AddressType {
PBYTE = 0 ,
PWORD ,
PLONG ,
PLONGLONG ,
DIRECT ,
UNKNOWN
} ;
struct A2L_CommunicatonModeSupported {
bool m_bIsBlockMode ;
bool m_bIsBlockSlaveMode ;
bool m_bIsBlockMasterMode ;
unsigned char m_cMaster_MAX_BS ; // MAX_BS
unsigned char m_cMaster_MIN_ST ; // MIN_ST
unsigned char m_cInterleaved ; // QUEUE_SIZE
} ;
struct A2L_XCP_Protocol_Layer {
uint32_t m_nXCPProtocolVersion ; /* XCP protocol layer version, current 0x100 */
uint32_t m_nTimeout_T1 ; /* T1 [ms] */
uint32_t m_nTimeout_T2 ; /* T2 [ms] */
uint32_t m_nTimeout_T3 ; /* T3 [ms] */
uint32_t m_nTimeout_T4 ; /* T4 [ms] */
uint32_t m_nTimeout_T5 ; /* T5 [ms] */
uint32_t m_nTimeout_T6 ; /* T6 [ms] */
uint32_t m_nTimeout_T7 ; /* T7 [ms] */
unsigned char m_cMAX_CTO ; /* MAX_CTO */
uint32_t m_nMAX_DTO ; /* MAX_DTO */
A2L_BYTE_ORDER_MSB_TYPE m_nByteOrderMSBType ;
A2L_ADDRESS_GRANULARITY_TYPE m_nAddressGranularityType ;
std : : list < unsigned char > m_nOptionalCommandList ;
A2L_CommunicatonModeSupported m_stCommunicationModeSupported ;
std : : string m_strSeedAndKeyExternalFunction ; // Name of the Seed&Key function
/*
" COMMUNICATION_MODE_SUPPORTED " taggedunion {
" BLOCK " taggedstruct {
" SLAVE " ;
" MASTER " struct {
uchar ; // MAX_BS
uchar ; // MIN_ST
} ;
} ;
" INTERLEAVED " uchar ; // QUEUE_SIZE
} ;
" SEED_AND_KEY_EXTERNAL_FUNCTION " char [ 256 ] ; // Name of the Seed&Key function
} ;
*/
} ;
struct A2L_StimBlock {
bool m_bIsUse ;
A2L_GranularityOdtEntrySizeStim m_nGranularityOdtEntrySizeStim ;
unsigned char m_cMaxOdtEntrySizeStim ;
} ;
struct A2l_DaqTimeStampSupported {
bool m_bIsUse ;
uint32_t m_nTimestampTicks ;
A2L_TimestampSupportedSize m_nTimestampSupportedSize ;
A2L_TimestampSupportedUnit m_nTimestampSupportedUnit ;
} ;
struct A2L_ODTEntry {
unsigned char m_cOdtEntryNumber ;
unsigned long m_lElementAddress ;
unsigned char m_cExtenstionElementAddress ;
unsigned char m_cElementSize ;
unsigned char m_cBitOffset ;
} ;
struct A2L_DaqListPredefined {
unsigned char m_cOdtNumber ;
std : : list < A2L_ODTEntry > m_OdtEntryList ;
} ;
struct A2L_DaqList {
uint32_t m_nDaqListNumber ;
A2L_DaqListType m_nDaqListType ;
unsigned char m_cMaxOdt ;
unsigned char m_cMaxOdtEntries ;
unsigned char m_cFirstPid ;
uint32_t m_nEventFixed ;
std : : list < A2L_DaqListPredefined > m_PredefinedList ;
} ;
struct A2L_DaqEvent {
std : : string m_strEventChannelName ; // max len 101
std : : string m_strEventChannelShortName ; // max len 9
uint32_t m_nEventChannelNumber ;
A2L_DaqEventType m_nDaqEventType ;
unsigned char m_cMaxDaqList ;
unsigned char m_cTimeCycle ;
unsigned char m_cTimeUnit ;
unsigned char m_cPriority ;
} ;
struct A2L_XCP_Daq {
A2L_DAQ_MODE_TYPE m_nDaqMode ;
uint32_t m_nMaxDaq ; /* MAX_DAQ */
uint32_t m_nMaxEventChannel ; /* MAX_EVENT_CHANNEL */
unsigned char m_cMinDaq ; /* MIN_DAQ */
A2L_DAQ_OPTIMISATION_TYPE m_nOptimisationType ;
A2L_DAQ_ADDRESS_EXTENSION m_nAddressExtention ;
A2L_DAQ_IDENTIFICATION_FIELD_TYPE m_nIdentificationFieldType ;
A2L_DAQ_GRANULARITY_ODT_ENTRY_SIZE m_nGranularityOdtSize ;
unsigned char m_cMaxOdtEntrySize ; /* MAX_ODT_ENTRY_SIZE_DAQ */
A2L_OverloadIndication m_nOverloadIndication ;
A2L_StimBlock m_nStimBlock ;
A2l_DaqTimeStampSupported m_nTimeStampSupported ;
std : : list < A2L_DaqList > m_nDaqList ;
std : : list < A2L_DaqEvent > m_nDaqEventList ;
} ;
struct A2L_XCP_PAG {
unsigned char m_cMaxSegments ;
} ;
struct A2L_PGMSector {
std : : string m_strSectorName ;
unsigned char m_cSectorNumber ;
unsigned long m_lAddress ;
unsigned long m_llength ;
unsigned char m_cClearSequenceNumber ;
unsigned char m_cProgramSequenceNumber ;
unsigned char m_cProgramMethod ;
} ;
struct A2L_XCP_PGM {
A2L_PGMMode m_nPGMMode ;
unsigned char m_nMaxSectors ;
unsigned char m_nMaxCtoPgm ;
A2L_CommunicatonModeSupported m_nCommunicationModeSupported ;
std : : list < A2L_PGMSector > m_nSectorList ;
} ;
struct A2L_DAQ_LIST_CAN_ID {
uint32_t m_nDaqListNumber ;
std : : list < unsigned long > m_lFixedDAQCanIDList ;
} ;
struct A2L_EVENT_LIST_CAN_ID {
uint32_t m_EventListNumber ;
std : : list < unsigned long > m_lFixedDAQCanIDList ;
} ;
struct A2L_XCP_CANFD {
uint32_t m_nMAXDlc ; // 8, 12, 16, 20, 24, 32, 48 or 64
unsigned long m_lBaudrate ; // BAUDRATE [Hz]
unsigned char m_cSamplePoint ;
unsigned char m_cBtlCycles ;
unsigned char m_cSJW ;
A2L_CAN_SYNC_EDGE m_nSyncEdge ;
bool m_bIsMaxDlcRequired ; // master to slave frames
unsigned char m_cSecondarySamplePoint ;
A2L_TRANSCEIVER_DELAY_COMPENSATION m_nTransceiverDelayCompensation ;
} ;
struct A2L_XCP_ON_CAN {
uint32_t m_nVersion ; // xcp on can version
unsigned long m_lCanIdBroadcast ; // auto detection CAN-ID
unsigned long m_lCanIDMater ; // CMD/STIM CAN-ID
unsigned long m_lCanIDSlave ; // RES/ERR/EV/SERV/DAQ CAN-ID
unsigned long m_lBaudrate ; // Baudrate in Hz
unsigned char m_cSamplePoint ; // Sample point in % of bit time
A2L_CAN_SAMPLE_RATE m_nSampleRate ;
unsigned char m_cBtlCycles ; // slots per bit time
unsigned char m_cSJW ;
A2L_CAN_SYNC_EDGE m_nSyncEdge ;
bool m_bIsMaxDlcRequired ; // master to slave frames
std : : list < A2L_DAQ_LIST_CAN_ID > m_DaqList ;
std : : list < A2L_EVENT_LIST_CAN_ID > m_EventList ;
A2L_XCP_CANFD m_stCANFD ;
} ;
struct A2L_IFDATAs_XCP {
uint32_t m_nXCPProtocolVersion ;
A2L_XCP_Protocol_Layer m_stProtocolLayer ; ;
A2L_XCP_Daq m_stDAQ ;
A2L_XCP_PAG m_stPAG ;
A2L_XCP_PGM m_stPGM ;
A2L_XCP_ON_CAN m_stXCPCAN ;
} ;
// 20260223 unit 추후에
struct A2L_UNIT {
std : : string m_strName ;
std : : string m_strDescription ;
std : : string m_strUnit ;
} ;
struct A2L_UNITs {
std : : list < A2L_UNIT > m_UnitList ;
} ;
struct COMPU_METHOD {
std : : string m_strName ;
std : : string m_strDescription ;
A2L_TAB_CONVERSION_TYPE m_nConversionType ;
std : : string m_strFormat ;
std : : string m_strUnit ;
std : : list < double > m_Coeffs ;
} ;
struct COMPU_METHODs {
std : : list < COMPU_METHOD > m_CompuMethodList ;
} ;
struct A2L_MEASUREMENT { // https://guide.intrepidcs.com/docs/asap2/a2l-item-area/measurements-tab/
std : : string m_strName ;
std : : string m_strDescription ;
A2L_DATA_TYPE m_cDataType ;
std : : string m_strCompuMothod ;
unsigned char m_cResolution ; // Smallest possible change in bits. (0 to 255)
unsigned char m_cAccuracy ; // Possible variation from exact value in %.
int32_t m_nLowerLimit ;
int32_t m_nUpperLimit ;
int64_t m_nBitmask ;
std : : string m_strFormat ; // Display formatting applied to numerical values. The syntax for this field is: %Length.Layout, Length = overall length, Layout = number of decimal places
std : : string m_strSymbolLink ;
int32_t m_nSymbolOffset ;
int32_t m_nECUAddress ;
std : : list < int32_t > m_MatrixDimSizeList ;
} ;
struct A2L_MEASUREMENTs {
std : : list < A2L_MEASUREMENT > m_MeasurementList ;
} ;
struct A2L_CHARACTERISTIC { // https://guide.intrepidcs.com/docs/asap2/a2l-item-area/characteristics-tab/
std : : string m_strName ;
std : : string m_strDescription ;
A2L_CHRACTERISTICS_TYPE m_cType ;
int32_t m_nAddress ;
std : : string m_strRecordLayoutName ;
int32_t m_nMaxDiff ;
std : : string m_strCompuMothod ;
std : : string m_strFormat ; // Display formatting applied to numerical values. The syntax for this field is: %Length.Layout, Length = overall length, Layout = number of decimal places
int32_t m_nLowerLimit ; // smallvalues, identify, bigvalue, linear, verbal, range byte
int32_t m_nUpperLimit ;
int32_t m_nLowerLimitEx ;
int32_t m_nUpperLimitEx ;
std : : string m_strSymbolLink ;
int32_t m_nSymbolOffset ;
std : : list < int32_t > m_MatrixDimSizeList ;
} ;
struct A2L_CHARACTERISTICs {
std : : list < A2L_CHARACTERISTIC > m_CharacteristicList ;
} ;
struct A2L_RECORDLAYOUT {
std : : string m_strName ;
int32_t m_nPosition ;
A2L_DATA_TYPE m_nDataType ;
A2L_IndexMode m_strIndexMode ;
A2L_AddressType m_strAddressType ;
} ;
struct A2L_RECORDLAYOUTs {
std : : list < A2L_RECORDLAYOUT > m_RecordLayoutList ;
} ;
struct A2L_Data {
A2L_IFDATAs_XCP m_stIFDATAs ;
A2L_UNITs m_stUnits ;
COMPU_METHODs m_stCompuMethods ;
A2L_MEASUREMENTs m_stMeasurements ;
A2L_CHARACTERISTICs m_stCharacteristics ;
A2L_RECORDLAYOUTs m_stRecordLayouts ;
} ;
# endif