forked from vectorgrp/XCPlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xcp.h
1148 lines (878 loc) · 48 KB
/
xcp.h
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* xcp.h */
/* Copyright(c) Vector Informatik GmbH.All rights reserved.
Licensed under the MIT license.See LICENSE file in the project root for details. */
/***************************************************************************/
/* Commands */
/***************************************************************************/
/*-------------------------------------------------------------------------*/
/* Standard Commands */
#define CC_CONNECT 0xFF
#define CC_DISCONNECT 0xFE
#define CC_GET_STATUS 0xFD
#define CC_SYNC 0xFC
#define CC_GET_COMM_MODE_INFO 0xFB
#define CC_GET_ID 0xFA
#define CC_SET_REQUEST 0xF9
#define CC_GET_SEED 0xF8
#define CC_UNLOCK 0xF7
#define CC_SET_MTA 0xF6
#define CC_UPLOAD 0xF5
#define CC_SHORT_UPLOAD 0xF4
#define CC_BUILD_CHECKSUM 0xF3
#define CC_TRANSPORT_LAYER_CMD 0xF2
#define CC_USER_CMD 0xF1
/*-------------------------------------------------------------------------*/
/* Calibration Commands*/
#define CC_DOWNLOAD 0xF0
#define CC_DOWNLOAD_NEXT 0xEF
#define CC_DOWNLOAD_MAX 0xEE
#define CC_SHORT_DOWNLOAD 0xED
#define CC_MODIFY_BITS 0xEC
/*-------------------------------------------------------------------------*/
/* Page switching Commands (PAG) */
#define CC_SET_CAL_PAGE 0xEB
#define CC_GET_CAL_PAGE 0xEA
#define CC_GET_PAG_PROCESSOR_INFO 0xE9
#define CC_GET_SEGMENT_INFO 0xE8
#define CC_GET_PAGE_INFO 0xE7
#define CC_SET_SEGMENT_MODE 0xE6
#define CC_GET_SEGMENT_MODE 0xE5
#define CC_COPY_CAL_PAGE 0xE4
/*-------------------------------------------------------------------------*/
/* Data acquisition and Stimulation Commands (DAQ/STIM) */
#define CC_CLEAR_DAQ_LIST 0xE3
#define CC_SET_DAQ_PTR 0xE2
#define CC_WRITE_DAQ 0xE1
#define CC_SET_DAQ_LIST_MODE 0xE0
#define CC_GET_DAQ_LIST_MODE 0xDF
#define CC_START_STOP_DAQ_LIST 0xDE
#define CC_START_STOP_SYNCH 0xDD
#define CC_GET_DAQ_CLOCK 0xDC
#define CC_READ_DAQ 0xDB
#define CC_GET_DAQ_PROCESSOR_INFO 0xDA
#define CC_GET_DAQ_RESOLUTION_INFO 0xD9
#define CC_GET_DAQ_LIST_INFO 0xD8
#define CC_GET_DAQ_EVENT_INFO 0xD7
#define CC_FREE_DAQ 0xD6
#define CC_ALLOC_DAQ 0xD5
#define CC_ALLOC_ODT 0xD4
#define CC_ALLOC_ODT_ENTRY 0xD3
/*-------------------------------------------------------------------------*/
/* Non volatile memory Programming Commands PGM */
#define CC_PROGRAM_START 0xD2
#define CC_PROGRAM_CLEAR 0xD1
#define CC_PROGRAM 0xD0
#define CC_PROGRAM_RESET 0xCF
#define CC_GET_PGM_PROCESSOR_INFO 0xCE
#define CC_GET_SECTOR_INFO 0xCD
#define CC_PROGRAM_PREPARE 0xCC
#define CC_PROGRAM_FORMAT 0xCB
#define CC_PROGRAM_NEXT 0xCA
#define CC_PROGRAM_MAX 0xC9
#define CC_PROGRAM_VERIFY 0xC8
/*-------------------------------------------------------------------------*/
/* XCP >= V1.1 Commands */
# define CC_WRITE_DAQ_MULTIPLE 0xC7 /* XCP V1.1 specific commands */
/*-------------------------------------------------------------------------*/
/* XCP >= V1.3 Commands */
#if XCP_PROTOCOL_LAYER_VERSION >= 0x0103
# define CC_TIME_CORRELATION_PROPERTIES 0xC6 /* XCP V1.3 specific commands */
#endif
/*-------------------------------------------------------------------------*/
/* XCP >= V1.4 Commands */
#if XCP_PROTOCOL_LAYER_VERSION >= 0x0104
#define CC_LEVEL_1_COMMAND 0xC0 /* XCP V1.4 Level 1 Commands: */
#define CC_GET_VERSION 0x00
#define CC_SET_DAQ_LIST_PACKED_MODE 0x01
#define CC_GET_DAQ_LIST_PACKED_MODE 0x02
#define CC_SW_DBG_OVER_XCP 0xFC
#endif
/*-------------------------------------------------------------------------*/
/* Packet Identifiers Slave -> Master */
#define PID_RES 0xFF /* response packet */
#define PID_ERR 0xFE /* error packet */
#define PID_EV 0xFD /* event packet */
#define PID_SERV 0xFC /* service request packet */
/*-------------------------------------------------------------------------*/
/* Command Return Codes */
#define CRC_CMD_SYNCH 0x00
#define CRC_CMD_BUSY 0x10
#define CRC_DAQ_ACTIVE 0x11
#define CRC_PRM_ACTIVE 0x12
#define CRC_CMD_UNKNOWN 0x20
#define CRC_CMD_SYNTAX 0x21
#define CRC_OUT_OF_RANGE 0x22
#define CRC_WRITE_PROTECTED 0x23
#define CRC_ACCESS_DENIED 0x24
#define CRC_ACCESS_LOCKED 0x25
#define CRC_PAGE_NOT_VALID 0x26
#define CRC_PAGE_MODE_NOT_VALID 0x27
#define CRC_SEGMENT_NOT_VALID 0x28
#define CRC_SEQUENCE 0x29
#define CRC_DAQ_CONFIG 0x2A
#define CRC_MEMORY_OVERFLOW 0x30
#define CRC_GENERIC 0x31
#define CRC_VERIFY 0x32
#define CRC_RESOURCE_TEMPORARY_NOT_ACCESSIBLE 0x33
#define CRC_SUBCMD_UNKNOWN 0x34
#define CRC_TIMECORR_STATE_CHANGE 0x35
/*-------------------------------------------------------------------------*/
/* Event Codes */
#define EVC_RESUME_MODE 0x00
#define EVC_CLEAR_DAQ 0x01
#define EVC_STORE_DAQ 0x02
#define EVC_STORE_CAL 0x03
#define EVC_CMD_PENDING 0x05
#define EVC_DAQ_OVERLOAD 0x06
#define EVC_SESSION_TERMINATED 0x07
#define EVC_TIME_SYNC 0x08
#define EVC_STIM_TIMEOUT 0x09
#define EVC_SLEEP 0x0A
#define EVC_WAKEUP 0x0B
#define EVC_ECU_STATE 0x0C
#define EVC_USER 0xFE
#define EVC_TRANSPORT 0xFF
/*-------------------------------------------------------------------------*/
/* Service Request Codes */
#define SERV_RESET 0x00 /* Slave requesting to be reset */
#define SERV_TEXT 0x01 /* Plain ASCII text null terminated */
/***************************************************************************/
/* Definitions */
/***************************************************************************/
/*-------------------------------------------------------------------------*/
/* ResourceMask (CONNECT) */
#define RM_CAL_PAG 0x01
#define RM_DAQ 0x04
#define RM_STIM 0x08
#define RM_PGM 0x10
#define RM_DBG 0x20
/*-------------------------------------------------------------------------*/
/* CommModeBasic (CONNECT) */
#define PI_MOTOROLA 0x01
#define CMB_BYTE_ORDER (0x01u<<0)
#define CMB_ADDRESS_GRANULARITY (0x03u<<1)
#define CMB_SLAVE_BLOCK_MODE (0x01u<<6)
#define CMB_OPTIONAL (0x01u<<7)
#define CMB_ADDRESS_GRANULARITY_BYTE (0<<1)
#define CMB_ADDRESS_GRANULARITY_WORD (1<<1)
#define CMB_ADDRESS_GRANULARITY_DWORD (2<<1)
#define CMB_ADDRESS_GRANULARITY_QWORD (3<<1)
/*-------------------------------------------------------------------------*/
/* Protocol Info (GET_COMM_MODE_INFO - COMM_OPTIONAL) */
#define CMO_MASTER_BLOCK_MODE 0x01
#define CMO_INTERLEAVED_MODE 0x02
/*-------------------------------------------------------------------------*/
/* Session Status (GET_STATUS and SET_REQUEST) */
#define SS_STORE_CAL_REQ 0x0001u
#define SS_BLOCK_UPLOAD 0x0002u /* Internal */
#define SS_STORE_DAQ_REQ 0x0004u
#define SS_CLEAR_DAQ_REQ 0x0008u
#define SS_LEGACY_MODE 0x0010u /* Internal XCP 1.3 legacy mode */
#define SS_CONNECTED 0x0020u /* Internal */
#define SS_DAQ 0x0040u
#define SS_RESUME 0x0080u
/*-------------------------------------------------------------------------*/
/* Identifier Type (GET_ID) */
#define IDT_ASCII 0
#define IDT_ASAM_NAME 1
#define IDT_ASAM_PATH 2
#define IDT_ASAM_URL 3
#define IDT_ASAM_UPLOAD 4
#define IDT_ASAM_EPK 5
#define IDT_ASAM_ECU 6
#define IDT_ASAM_SYSID 7
#define IDT_VECTOR_MDI 0xDC
#define IDT_VECTOR_MAPNAMES 0xDB
/*-------------------------------------------------------------------------*/
/* Checksum Types (BUILD_CHECKSUM) */
#define XCP_CHECKSUM_TYPE_ADD11 0x01 /* Add BYTE into a BYTE checksum, ignore overflows */
#define XCP_CHECKSUM_TYPE_ADD12 0x02 /* Add BYTE into a WORD checksum, ignore overflows */
#define XCP_CHECKSUM_TYPE_ADD14 0x03 /* Add BYTE into a DWORD checksum, ignore overflows */
#define XCP_CHECKSUM_TYPE_ADD22 0x04 /* Add WORD into a WORD checksum, ignore overflows, blocksize must be modulo 2 */
#define XCP_CHECKSUM_TYPE_ADD24 0x05 /* Add WORD into a DWORD checksum, ignore overflows, blocksize must be modulo 2 */
#define XCP_CHECKSUM_TYPE_ADD44 0x06 /* Add DWORD into DWORD, ignore overflows, blocksize must be modulo 4 */
#define XCP_CHECKSUM_TYPE_CRC16 0x07 /* See CRC error detection algorithms */
#define XCP_CHECKSUM_TYPE_CRC16CCITT 0x08 /* See CRC error detection algorithms */
#define XCP_CHECKSUM_TYPE_CRC32 0x09 /* See CRC error detection algorithms */
#define XCP_CHECKSUM_TYPE_DLL 0xFF /* User defined, ASAM MCD 2MC DLL Interface */
/*-------------------------------------------------------------------------*/
/* Page Mode (SET_CAL_PAGE) */
#define CAL_ECU 0x01
#define CAL_XCP 0x02
#define CAL_ALL 0x80 /* not supported */
/*-------------------------------------------------------------------------*/
/* PAG_PROPERTIES (GET_PAG_PROCESSOR_INFO) */
#define PAG_PROPERTY_FREEZE 0x01
/*-------------------------------------------------------------------------*/
/* PAGE_PROPERTIES (GET_PAGE_INFO)*/
#define ECU_ACCESS_TYPE 0x03
#define XCP_READ_ACCESS_TYPE 0x0C
#define XCP_WRITE_ACCESS_TYPE 0x30
/* ECU_ACCESS_TYPE */
#define ECU_ACCESS_NONE (0<<0)
#define ECU_ACCESS_WITHOUT (1<<0)
#define ECU_ACCESS_WITH (2<<0)
#define ECU_ACCESS_DONT_CARE (3<<0)
/* XCP_READ_ACCESS_TYPE */
#define XCP_READ_ACCESS_NONE (0<<2)
#define XCP_READ_ACCESS_WITHOUT (1<<2)
#define XCP_READ_ACCESS_WITH (2<<2)
#define XCP_READ_ACCESS_DONT_CARE (3<<2)
/* XCP_WRITE_ACCESS_TYPE */
#define XCP_WRITE_ACCESS_NONE (0<<4)
#define XCP_WRITE_ACCESS_WITHOUT (1<<4)
#define XCP_WRITE_ACCESS_WITH (2<<4)
#define XCP_WRITE_ACCESS_DONT_CARE (3<<4)
/*-------------------------------------------------------------------------*/
/* SEGMENT_MODE (GET_SEGMENT_MODE, SET_SEGMENT_MODE) */
#define SEGMENT_FLAG_FREEZE 0x01 /* */
/*-------------------------------------------------------------------------*/
/* DAQ_LIST_MODE (GET_DAQ_LIST_MODE, SET_DAQ_LIST_MODE) */
#define DAQ_FLAG_SELECTED 0x01u /* */
#define DAQ_FLAG_DIRECTION 0x02u /* Data Stimulation Mode */
#define DAQ_FLAG_CMPL_DAQ_CH 0x04u /* Complementary DAQ channel */
#define DAQ_FLAG_TIMESTAMP 0x10u /* Timestamps */
#define DAQ_FLAG_NO_PID 0x20u /* No PID */
#define DAQ_FLAG_RUNNING 0x40u /* Is started */
#define DAQ_FLAG_RESUME 0x80u /* Resume Mode */
#define DAQ_FLAG_RESERVED 0x08u
#define DAQ_FLAG_OVERRUN 0x08u /* Overun (Internal Use) */
/*-------------------------------------------------------------------------*/
/* GET_DAQ_PROCESSOR_INFO */
/* DAQ_PROPERTIES */
#define DAQ_PROPERTY_CONFIG_TYPE 0x01
#define DAQ_PROPERTY_PRESCALER 0x02
#define DAQ_PROPERTY_RESUME 0x04
#define DAQ_PROPERTY_BIT_STIM 0x08
#define DAQ_PROPERTY_TIMESTAMP 0x10
#define DAQ_PROPERTY_NO_PID 0x20
#define DAQ_PROPERTY_OVERLOAD_INDICATION 0xC0
/* DAQ Overload Indication Type */
#define DAQ_OVERLOAD_INDICATION_NONE (0<<6)
#define DAQ_OVERLOAD_INDICATION_PID (1<<6)
#define DAQ_OVERLOAD_INDICATION_EVENT (2<<6)
/* DAQ_KEY_BYTE */
#define DAQ_OPT_TYPE 0x0F
#define DAQ_EXT_TYPE 0x30
#define DAQ_HDR_TYPE 0xC0
/* DAQ Optimisation Type */
#define DAQ_OPT_DEFAULT (0<<0)
#define DAQ_OPT_ODT_16 (1<<0)
#define DAQ_OPT_ODT_32 (2<<0)
#define DAQ_OPT_ODT_64 (3<<0)
#define DAQ_OPT_ALIGNMENT (4<<0)
#define DAQ_OPT_MAX_ENTRY_SIZE (5<<0)
/* DAQ Address Extension Scope */
#define DAQ_EXT_FREE (0<<4)
#define DAQ_EXT_ODT (1<<4)
#define DAQ_EXT_DAQ (3<<4)
/* DAQ Identification Field Type */
#define DAQ_HDR_PID (0<<6)
#define DAQ_HDR_ODT_DAQB (1<<6)
#define DAQ_HDR_ODT_DAQW (2<<6)
#define DAQ_HDR_ODT_FIL_DAQW (3<<6)
/*-------------------------------------------------------------------------*/
/* GET_DAQ_RESOLUTION_INFO */
/* TIMESTAMP_MODE Bitmasks */
#define DAQ_TIMESTAMP_TYPE 0x07
#define DAQ_TIMESTAMP_FIXED 0x08
#define DAQ_TIMESTAMP_UNIT 0xF0
/* DAQ Timestamp Type */
#define DAQ_TIMESTAMP_OFF (0<<0)
#define DAQ_TIMESTAMP_BYTE (1<<0)
#define DAQ_TIMESTAMP_WORD (2<<0)
#define DAQ_TIMESTAMP_DWORD (4<<0)
#define DAQ_TIMESTAMP_QWORD (7<<0) // @@@@ XCP V1.6 64 bit DAQ DTO timestamp
/* DAQ Timestamp Unit */
#define DAQ_TIMESTAMP_UNIT_1NS (0<<4)
#define DAQ_TIMESTAMP_UNIT_10NS (1<<4)
#define DAQ_TIMESTAMP_UNIT_100NS (2<<4)
#define DAQ_TIMESTAMP_UNIT_1US (3<<4)
#define DAQ_TIMESTAMP_UNIT_10US (4<<4)
#define DAQ_TIMESTAMP_UNIT_100US (5<<4)
#define DAQ_TIMESTAMP_UNIT_1MS (6<<4)
#define DAQ_TIMESTAMP_UNIT_10MS (7<<4)
#define DAQ_TIMESTAMP_UNIT_100MS (8<<4)
#define DAQ_TIMESTAMP_UNIT_1S (9<<4)
/*-------------------------------------------------------------------------*/
/* DAQ_LIST_PROPERTIES (GET_DAQ_LIST_INFO) */
#define DAQ_LIST_PREDEFINED 0x01
#define DAQ_LIST_FIXED_EVENT 0x02
#define DAQ_LIST_DIR_DAQ 0x04
#define DAQ_LIST_DIR_STIM 0x08
#define DAQ_LIST_PACKED 0x10
/*-------------------------------------------------------------------------*/
/* EVENT_PROPERTY (GET_DAQ_EVENT_INFO) */
#define DAQ_EVENT_DIRECTION_DAQ 0x04
#define DAQ_EVENT_DIRECTION_STIM 0x08
#define DAQ_EVENT_DIRECTION_DAQ_STIM 0x0C
/*-------------------------------------------------------------------------*/
/* Comm mode programming parameter (PROGRAM_START) */
#define PI_PGM_BLOCK_DOWNLOAD 0x01
#define PI_PGM_BLOCK_UPLOAD 0x40
/*-------------------------------------------------------------------------*/
/* PGM_PROPERTIES (GET_PGM_PROCESSOR_INFO) */
#define PGM_ACCESS_TYPE 0x03
#define PGM_COMPRESSION_TYPE 0x0C
#define PGM_ENCRYPTION_TYPE 0x30
#define PGM_NON_SEQ_TYPE 0xC0
/* PGM Access Mode */
#define PGM_ACCESS_ABSOLUTE (1<<0)
#define PGM_ACCESS_FUNCTIONAL (2<<0)
#define PGM_ACCESS_FREE (3<<0)
/* PGM Compression type */
#define PGM_COMPRESSION_NONE (0<<2)
#define PGM_COMPRESSION_SUPPORTED (1<<2)
#define PGM_COMPRESSION_REQUIRED (3<<2)
/* PGM Encryption type */
#define PGM_ENCRYPTION_NONE (0<<4)
#define PGM_ENCRYPTION_SUPPORTED (1<<4)
#define PGM_ENCRYPTION_REQUIRED (3<<4)
/* PGM non sequential programming type */
#define PGM_NON_SEQ_NONE (0<<6)
#define PGM_NON_SEQ_SUPPORTED (1<<6)
#define PGM_NON_SEQ_REQUIRED (3<<6)
/***************************************************************************/
/* XCP Protocol Commands and Responces, Type Definition */
/***************************************************************************/
/* Protocol command structure definition */
#define CRO_CMD CRO_BYTE(0)
#define CRM_CMD CRM_BYTE(0)
#define CRM_ERR CRM_BYTE(1)
#define CRM_EVENTCODE CRM_BYTE(1)
/* CONNECT */
#define CRO_CONNECT_LEN 2
#define CRO_CONNECT_MODE CRO_BYTE(1)
#define CRM_CONNECT_LEN 8
#define CRM_CONNECT_RESOURCE CRM_BYTE(1)
#define CRM_CONNECT_COMM_BASIC CRM_BYTE(2)
#define CRM_CONNECT_MAX_CTO_SIZE CRM_BYTE(3)
#define CRM_CONNECT_MAX_DTO_SIZE CRM_WORD(2)
#define CRM_CONNECT_PROTOCOL_VERSION CRM_BYTE(6)
#define CRM_CONNECT_TRANSPORT_VERSION CRM_BYTE(7)
/* DISCONNECT */
#define CRO_DISCONNECT_LEN 1
#define CRM_DISCONNECT_LEN 1
/* GET_STATUS */
#define CRO_GET_STATUS_LEN 1
#define CRM_GET_STATUS_LEN 6
#define CRM_GET_STATUS_STATUS CRM_BYTE(1)
#define CRM_GET_STATUS_PROTECTION CRM_BYTE(2)
#define CRM_GET_STATUS_CONFIG_ID CRM_WORD(2)
/* SYNCH */
#define CRO_SYNCH_LEN 1
#define CRM_SYNCH_LEN 2
#define CRM_SYNCH_RESULT CRM_BYTE(1)
/* GET_COMM_MODE_INFO */
#define CRO_GET_COMM_MODE_INFO_LEN 1
#define CRM_GET_COMM_MODE_INFO_LEN 8
#define CRM_GET_COMM_MODE_INFO_COMM_OPTIONAL CRM_BYTE(2)
#define CRM_GET_COMM_MODE_INFO_MAX_BS CRM_BYTE(4)
#define CRM_GET_COMM_MODE_INFO_MIN_ST CRM_BYTE(5)
#define CRM_GET_COMM_MODE_INFO_QUEUE_SIZE CRM_BYTE(6)
#define CRM_GET_COMM_MODE_INFO_DRIVER_VERSION CRM_BYTE(7)
/* GET_ID */
#define CRO_GET_ID_LEN 2
#define CRO_GET_ID_TYPE CRO_BYTE(1)
#define CRM_GET_ID_LEN 8
#define CRM_GET_ID_MODE CRM_BYTE(1)
#define CRM_GET_ID_LENGTH CRM_DWORD(1)
#define CRM_GET_ID_DATA (&CRM_BYTE(8))
/* SET_REQUEST */
#define CRO_SET_REQUEST_LEN 4
#define CRO_SET_REQUEST_MODE CRO_BYTE(1)
#define CRO_SET_REQUEST_CONFIG_ID CRO_WORD(1)
#define CRM_SET_REQUEST_LEN 1
/* GET_SEED */
#define CRO_GET_SEED_LEN 3
#define CRO_GET_SEED_MODE CRO_BYTE(1)
#define CRO_GET_SEED_RESOURCE CRO_BYTE(2)
#define CRM_GET_SEED_LEN (CRM_GET_SEED_LENGTH+2u)
#define CRM_GET_SEED_LENGTH CRM_BYTE(1)
#define CRM_GET_SEED_DATA (&CRM_BYTE(2))
/* UNLOCK */
#define CRO_UNLOCK_LEN 8
#define CRO_UNLOCK_LENGTH CRO_BYTE(1)
#define CRO_UNLOCK_KEY (&CRO_BYTE(2))
#define CRM_UNLOCK_LEN 2
#define CRM_UNLOCK_PROTECTION CRM_BYTE(1)
/* SET_MTA */
#define CRO_SET_MTA_LEN 8
#define CRO_SET_MTA_EXT CRO_BYTE(3)
#define CRO_SET_MTA_ADDR CRO_DWORD(1)
#define CRM_SET_MTA_LEN 1
/* UPLOAD */
#define CRM_UPLOAD_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-1))
#define CRO_UPLOAD_LEN 2
#define CRO_UPLOAD_SIZE CRO_BYTE(1)
#define CRM_UPLOAD_LEN 1 /* +CRO_UPLOAD_SIZE */
#define CRM_UPLOAD_DATA (&CRM_BYTE(1))
/* SHORT_UPLOAD */
#define CRO_SHORT_UPLOAD_LEN 8
#define CRO_SHORT_UPLOAD_SIZE CRO_BYTE(1)
#define CRO_SHORT_UPLOAD_EXT CRO_BYTE(3)
#define CRO_SHORT_UPLOAD_ADDR CRO_DWORD(1)
#define CRM_SHORT_UPLOAD_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-1))
#define CRM_SHORT_UPLOAD_LEN 1u /* +CRO_SHORT_UPLOAD_SIZE */
#define CRM_SHORT_UPLOAD_DATA (&CRM_BYTE(1))
/* BUILD_CHECKSUM */
#define CRO_BUILD_CHECKSUM_LEN 8
#define CRO_BUILD_CHECKSUM_SIZE CRO_DWORD(1)
#define CRM_BUILD_CHECKSUM_LEN 8
#define CRM_BUILD_CHECKSUM_TYPE CRM_BYTE(1)
#define CRM_BUILD_CHECKSUM_RESULT CRM_DWORD(1)
/* DOWNLOAD */
#define CRO_DOWNLOAD_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-2))
#define CRO_DOWNLOAD_LEN 2 /* + CRO_DOWNLOAD_SIZE */
#define CRO_DOWNLOAD_SIZE CRO_BYTE(1)
#define CRO_DOWNLOAD_DATA (&CRO_BYTE(2))
#define CRM_DOWNLOAD_LEN 1
/* DOWNLOAD_NEXT */
#define CRO_DOWNLOAD_NEXT_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-2))
#define CRO_DOWNLOAD_NEXT_LEN 2 /* + size */
#define CRO_DOWNLOAD_NEXT_SIZE CRO_BYTE(1)
#define CRO_DOWNLOAD_NEXT_DATA (&CRO_BYTE(2))
#define CRM_DOWNLOAD_NEXT_LEN 1
/* DOWNLOAD_MAX */
#define CRO_DOWNLOAD_MAX_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-1))
#define CRO_DOWNLOAD_MAX_DATA (&CRO_BYTE(1))
#define CRM_DOWNLOAD_MAX_LEN 1
/* SHORT_DOWNLOAD */
#define CRO_SHORT_DOWNLOAD_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-8))
#define CRO_SHORT_DOWNLOAD_LEN 8
#define CRO_SHORT_DOWNLOAD_SIZE CRO_BYTE(1)
#define CRO_SHORT_DOWNLOAD_EXT CRO_BYTE(3)
#define CRO_SHORT_DOWNLOAD_ADDR CRO_DWORD(1)
#define CRO_SHORT_DOWNLOAD_DATA (&CRO_BYTE(8))
#define CRM_SHORT_DOWNLOAD_LEN 1 /* +CRO_SHORT_UPLOAD_SIZE */
/* MODIFY_BITS */
#define CRO_MODIFY_BITS_LEN 6
#define CRO_MODIFY_BITS_SHIFT CRO_BYTE(1)
#define CRO_MODIFY_BITS_AND CRO_WORD(1)
#define CRO_MODIFY_BITS_XOR CRO_WORD(2)
#define CRM_MODIFY_BITS_LEN 1
/* SET_CAL_PAGE */
#define CRO_SET_CAL_PAGE_LEN 4
#define CRO_SET_CAL_PAGE_MODE CRO_BYTE(1)
#define CRO_SET_CAL_PAGE_SEGMENT CRO_BYTE(2)
#define CRO_SET_CAL_PAGE_PAGE CRO_BYTE(3)
#define CRM_SET_CAL_PAGE_LEN 1
/* GET_CAL_PAGE */
#define CRO_GET_CAL_PAGE_LEN 3
#define CRO_GET_CAL_PAGE_MODE CRO_BYTE(1)
#define CRO_GET_CAL_PAGE_SEGMENT CRO_BYTE(2)
#define CRM_GET_CAL_PAGE_LEN 4
#define CRM_GET_CAL_PAGE_PAGE CRM_BYTE(3)
/* GET_PAG_PROCESSOR_INFO */
#define CRO_GET_PAG_PROCESSOR_INFO_LEN 1
#define CRM_GET_PAG_PROCESSOR_INFO_LEN 3
#define CRM_GET_PAG_PROCESSOR_INFO_MAX_SEGMENT CRM_BYTE(1)
#define CRM_GET_PAG_PROCESSOR_INFO_PROPERTIES CRM_BYTE(2)
/* GET_SEGMENT_INFO */
#define CRO_GET_SEGMENT_INFO_LEN 5
#define CRO_GET_SEGMENT_INFO_MODE CRO_BYTE(1)
#define CRO_GET_SEGMENT_INFO_NUMBER CRO_BYTE(2)
#define CRO_GET_SEGMENT_INFO_MAPPING_INDEX CRO_BYTE(3)
#define CRO_GET_SEGMENT_INFO_MAPPING CRO_BYTE(4)
#define CRM_GET_SEGMENT_INFO_LEN 8
#define CRM_GET_SEGMENT_INFO_MAX_PAGES CRM_BYTE(1)
#define CRM_GET_SEGMENT_INFO_ADDRESS_EXTENSION CRM_BYTE(2)
#define CRM_GET_SEGMENT_INFO_MAX_MAPPING CRM_BYTE(3)
#define CRM_GET_SEGMENT_INFO_COMPRESSION CRM_BYTE(4)
#define CRM_GET_SEGMENT_INFO_ENCRYPTION CRM_BYTE(5)
#define CRM_GET_SEGMENT_INFO_MAPPING_INFO CRM_DWORD(1)
/* GET_PAGE_INFO */
#define CRO_GET_PAGE_INFO_LEN 4
#define CRO_GET_PAGE_INFO_SEGMENT_NUMBER CRO_BYTE(2)
#define CRO_GET_PAGE_INFO_PAGE_NUMBER CRO_BYTE(3)
#define CRM_GET_PAGE_INFO_LEN 3
#define CRM_GET_PAGE_INFO_PROPERTIES CRM_BYTE(1)
#define CRM_GET_PAGE_INFO_INIT_SEGMENT CRM_BYTE(2)
/* SET_SEGMENT_MODE */
#define CRO_SET_SEGMENT_MODE_LEN 3
#define CRO_SET_SEGMENT_MODE_MODE CRO_BYTE(1)
#define CRO_SET_SEGMENT_MODE_SEGMENT CRO_BYTE(2)
#define CRM_SET_SEGMENT_MODE_LEN 1
/* GET_SEGMENT_MODE */
#define CRO_GET_SEGMENT_MODE_LEN 3
#define CRO_GET_SEGMENT_MODE_SEGMENT CRO_BYTE(2)
#define CRM_GET_SEGMENT_MODE_LEN 3
#define CRM_GET_SEGMENT_MODE_MODE CRM_BYTE(2)
/* COPY_CAL_PAGE */
#define CRO_COPY_CAL_PAGE_LEN 5
#define CRO_COPY_CAL_PAGE_SRC_SEGMENT CRO_BYTE(1)
#define CRO_COPY_CAL_PAGE_SRC_PAGE CRO_BYTE(2)
#define CRO_COPY_CAL_PAGE_DEST_SEGMENT CRO_BYTE(3)
#define CRO_COPY_CAL_PAGE_DEST_PAGE CRO_BYTE(4)
#define CRM_COPY_CAL_PAGE_LEN 1
/* CLEAR_DAQ_LIST */
#define CRO_CLEAR_DAQ_LIST_LEN 4
#define CRO_CLEAR_DAQ_LIST_DAQ CRO_WORD(1)
#define CRM_CLEAR_DAQ_LIST_LEN 1
/* SET_DAQ_PTR */
#define CRO_SET_DAQ_PTR_LEN 6
#define CRO_SET_DAQ_PTR_DAQ CRO_WORD(1)
#define CRO_SET_DAQ_PTR_ODT CRO_BYTE(4)
#define CRO_SET_DAQ_PTR_IDX CRO_BYTE(5)
#define CRM_SET_DAQ_PTR_LEN 1
/* WRITE_DAQ */
#define CRO_WRITE_DAQ_LEN 8
#define CRO_WRITE_DAQ_BITOFFSET CRO_BYTE(1)
#define CRO_WRITE_DAQ_SIZE CRO_BYTE(2)
#define CRO_WRITE_DAQ_EXT CRO_BYTE(3)
#define CRO_WRITE_DAQ_ADDR CRO_DWORD(1)
#define CRM_WRITE_DAQ_LEN 1
/* WRITE_DAQ_MULTIPLE */
#define CRO_WRITE_DAQ_MULTIPLE_LEN 8
#define CRO_WRITE_DAQ_MULTIPLE_NODAQ CRO_BYTE(1)
#define CRO_WRITE_DAQ_MULTIPLE_BITOFFSET(i) CRO_BYTE(2 + (8*(i)))
#define CRO_WRITE_DAQ_MULTIPLE_SIZE(i) CRO_BYTE(3 + (8*(i)))
#define CRO_WRITE_DAQ_MULTIPLE_ADDR(i) CRO_DWORD(1 + (2*(i)))
#define CRO_WRITE_DAQ_MULTIPLE_EXT(i) CRO_BYTE(8 + (8*(i)))
#define CRM_WRITE_DAQ_MULTIPLE_LEN 1
/* SET_DAQ_LIST_MODE */
#define CRO_SET_DAQ_LIST_MODE_LEN 8
#define CRO_SET_DAQ_LIST_MODE_MODE CRO_BYTE(1)
#define CRO_SET_DAQ_LIST_MODE_DAQ CRO_WORD(1)
#define CRO_SET_DAQ_LIST_MODE_EVENTCHANNEL CRO_WORD(2)
#define CRO_SET_DAQ_LIST_MODE_PRESCALER CRO_BYTE(6)
#define CRO_SET_DAQ_LIST_MODE_PRIORITY CRO_BYTE(7)
#define CRM_SET_DAQ_LIST_MODE_LEN 6
/* GET_DAQ_LIST_MODE */
#define CRO_GET_DAQ_LIST_MODE_LEN 4
#define CRO_GET_DAQ_LIST_MODE_DAQ CRO_WORD(1)
#define CRM_GET_DAQ_LIST_MODE_LEN 8
#define CRM_GET_DAQ_LIST_MODE_MODE CRM_BYTE(1)
#define CRM_GET_DAQ_LIST_MODE_EVENTCHANNEL CRM_WORD(2)
#define CRM_GET_DAQ_LIST_MODE_PRESCALER CRM_BYTE(6)
#define CRM_GET_DAQ_LIST_MODE_PRIORITY CRM_BYTE(7)
/* START_STOP_DAQ_LIST */
#define CRO_START_STOP_LEN 4
#define CRO_START_STOP_MODE CRO_BYTE(1)
#define CRO_START_STOP_DAQ CRO_WORD(1)
#define CRM_START_STOP_LEN 2
#define CRM_START_STOP_FIRST_PID CRM_BYTE(1)
/* START_STOP_SYNCH */
#define CRO_START_STOP_SYNC_LEN 2
#define CRO_START_STOP_SYNC_MODE CRO_BYTE(1)
#define CRM_START_STOP_SYNC_LEN 1
/* GET_DAQ_CLOCK */
#define CRO_GET_DAQ_CLOCK_LEN 1
#define CRM_GET_DAQ_CLOCK_LEN 8
#if XCP_PROTOCOL_LAYER_VERSION >= 0x0103
#define CRM_GET_DAQ_CLOCK_RES1 CRM_BYTE(1)
#define CRM_GET_DAQ_CLOCK_TRIGGER_INFO CRM_BYTE(2)
#define CRM_GET_DAQ_CLOCK_PAYLOAD_FMT CRM_BYTE(3)
#define CRM_GET_DAQ_CLOCK_TIME CRM_DWORD(1)
#define CRM_GET_DAQ_CLOCK_TIME64 CRM_DDWORD(1) // Byte number is 4
#define CRM_GET_DAQ_CLOCK_SYNC_STATE CRM_BYTE(8)
#define CRM_GET_DAQ_CLOCK_SYNC_STATE64 CRM_BYTE(12)
#else
#define CRM_GET_DAQ_CLOCK_TIME CRM_DWORD(1)
#endif
/* GET_DAQ_CLOCK_MULTICAST */
#define CRO_DAQ_CLOCK_MCAST_CLUSTER_IDENTIFIER CRO_WORD(1)
#define CRO_DAQ_CLOCK_MCAST_COUNTER CRO_BYTE(4)
#define CRM_DAQ_CLOCK_MCAST_CLUSTER_IDENTIFIER CRM_WORD(4)
#define CRM_DAQ_CLOCK_MCAST_COUNTER CRM_BYTE(10)
#define CRM_DAQ_CLOCK_MCAST_SYNC_STATE CRM_BYTE(11)
#define CRM_DAQ_CLOCK_MCAST_CLUSTER_IDENTIFIER64 CRM_WORD(6)
#define CRM_DAQ_CLOCK_MCAST_COUNTER64 CRM_BYTE(14)
#define CRM_DAQ_CLOCK_MCAST_SYNC_STATE64 CRM_BYTE(15)
/* READ_DAQ */
#define CRO_READ_DAQ_LEN 1
#define CRM_READ_DAQ_LEN 8
#define CRM_READ_DAQ_BITOFFSET CRM_BYTE(1)
#define CRM_READ_DAQ_SIZE CRM_BYTE(2)
#define CRM_READ_DAQ_EXT CRM_BYTE(3)
#define CRM_READ_DAQ_ADDR CRM_DWORD(1)
/* GET_DAQ_PROCESSOR_INFO */
#define CRO_GET_DAQ_PROCESSOR_INFO_LEN 1
#define CRM_GET_DAQ_PROCESSOR_INFO_LEN 8
#define CRM_GET_DAQ_PROCESSOR_INFO_PROPERTIES CRM_BYTE(1)
#define CRM_GET_DAQ_PROCESSOR_INFO_MAX_DAQ CRM_WORD(1)
#define CRM_GET_DAQ_PROCESSOR_INFO_MAX_EVENT CRM_WORD(2)
#define CRM_GET_DAQ_PROCESSOR_INFO_MIN_DAQ CRM_BYTE(6)
#define CRM_GET_DAQ_PROCESSOR_INFO_DAQ_KEY_BYTE CRM_BYTE(7)
/* GET_DAQ_RESOLUTION_INFO */
#define CRO_GET_DAQ_RESOLUTION_INFO_LEN 1
#define CRM_GET_DAQ_RESOLUTION_INFO_LEN 8
#define CRM_GET_DAQ_RESOLUTION_INFO_GRANULARITY_DAQ CRM_BYTE(1)
#define CRM_GET_DAQ_RESOLUTION_INFO_MAX_SIZE_DAQ CRM_BYTE(2)
#define CRM_GET_DAQ_RESOLUTION_INFO_GRANULARITY_STIM CRM_BYTE(3)
#define CRM_GET_DAQ_RESOLUTION_INFO_MAX_SIZE_STIM CRM_BYTE(4)
#define CRM_GET_DAQ_RESOLUTION_INFO_TIMESTAMP_MODE CRM_BYTE(5)
#define CRM_GET_DAQ_RESOLUTION_INFO_TIMESTAMP_TICKS CRM_WORD(3)
#define CRM_GET_DAQ_RESOLUTION_INFO_TIMESTAMP_TICKS_WRITE(ticks) CRM_WORD_WRITE(3, ticks)
/* GET_DAQ_LIST_INFO */
#define CRO_GET_DAQ_LIST_INFO_LEN 4
#define CRO_GET_DAQ_LIST_INFO_DAQ CRO_WORD(1)
#define CRM_GET_DAQ_LIST_INFO_LEN 6
#define CRM_GET_DAQ_LIST_INFO_PROPERTIES CRM_BYTE(1)
#define CRM_GET_DAQ_LIST_INFO_MAX_ODT CRM_BYTE(2)
#define CRM_GET_DAQ_LIST_INFO_MAX_ODT_ENTRY CRM_BYTE(3)
#define CRM_GET_DAQ_LIST_INFO_FIXED_EVENT CRM_WORD(2)
/* GET_DAQ_EVENT_INFO */
#define CRO_GET_DAQ_EVENT_INFO_LEN 4
#define CRO_GET_DAQ_EVENT_INFO_EVENT CRO_WORD(1)
#if XCP_PROTOCOL_LAYER_VERSION >= 0x0106
#define CRM_GET_DAQ_EVENT_INFO_LEN 12
#else
#define CRM_GET_DAQ_EVENT_INFO_LEN 7
#endif
#define CRM_GET_DAQ_EVENT_INFO_PROPERTIES CRM_BYTE(1)
#define CRM_GET_DAQ_EVENT_INFO_MAX_DAQ_LIST CRM_BYTE(2)
#define CRM_GET_DAQ_EVENT_INFO_NAME_LENGTH CRM_BYTE(3)
#define CRM_GET_DAQ_EVENT_INFO_TIME_CYCLE CRM_BYTE(4)
#define CRM_GET_DAQ_EVENT_INFO_TIME_UNIT CRM_BYTE(5)
#define CRM_GET_DAQ_EVENT_INFO_PRIORITY CRM_BYTE(6)
#define CRM_GET_DAQ_EVENT_INFO_SIZE CRM_WORD(4) // @@@@ XCP V1.6 ext event full data size
#define CRM_GET_DAQ_EVENT_INFO_SAMPLECOUNT CRM_WORD(5) // @@@@ XCP V1.6 packed sample count
#define DAQ_EVENT_PROPERTIES_DAQ 0x04
#define DAQ_EVENT_PROPERTIES_STIM 0x08
#define DAQ_EVENT_PROPERTIES_PACKED 0x10
#define DAQ_EVENT_PROPERTIES_EXT 0x20 // @@@@ XCP V1.6
#define DAQ_EVENT_PROPERTIES_EVENT_CONSISTENCY 0x80
/* FREE_DAQ */
#define CRO_FREE_DAQ_LEN 1
#define CRM_FREE_DAQ_LEN 1
/* ALLOC_DAQ */
#define CRO_ALLOC_DAQ_LEN 4
#define CRO_ALLOC_DAQ_COUNT CRO_WORD(1)
#define CRM_ALLOC_DAQ_LEN 1
/* ALLOC_ODT */
#define _CRO_ALLOC_ODT_LEN 3
#define _CRO_ALLOC_ODT_DAQ CRO_WORD(1)
#define _CRO_ALLOC_ODT_COUNT CRO_BYTE(1)
#define CRO_ALLOC_ODT_LEN 5
#define CRO_ALLOC_ODT_DAQ CRO_WORD(1)
#define CRO_ALLOC_ODT_COUNT CRO_BYTE(4)
#define CRM_ALLOC_ODT_LEN 1
/* ALLOC_ODT_ENTRY */
#define CRO_ALLOC_ODT_ENTRY_LEN 6
#define CRO_ALLOC_ODT_ENTRY_DAQ CRO_WORD(1)
#define CRO_ALLOC_ODT_ENTRY_ODT CRO_BYTE(4)
#define CRO_ALLOC_ODT_ENTRY_COUNT CRO_BYTE(5)
#define CRM_ALLOC_ODT_ENTRY_LEN 1
/* PROGRAM_START */
#define CRO_PROGRAM_START_LEN 1
#define CRM_PROGRAM_START_LEN 7
#define CRM_PROGRAM_COMM_MODE_PGM CRM_BYTE(2)
#define CRM_PROGRAM_MAX_CTO_PGM CRM_BYTE(3)
#define CRM_PROGRAM_MAX_BS_PGM CRM_BYTE(4)
#define CRM_PROGRAM_MIN_ST_PGM CRM_BYTE(5)
#define CRM_PROGRAM_QUEUE_SIZE_PGM CRM_BYTE(6)
/* PROGRAM_CLEAR */
#define CRO_PROGRAM_CLEAR_LEN 8
#define CRO_PROGRAM_CLEAR_MODE CRO_BYTE(1)
#define CRO_PROGRAM_CLEAR_SIZE CRO_DWORD(1)
#define CRM_PROGRAM_CLEAR_LEN 1
/* PROGRAM */
#define CRO_PROGRAM_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-2))
#define CRO_PROGRAM_LEN 2 /* + CRO_PROGRAM_SIZE */
#define CRO_PROGRAM_SIZE CRO_BYTE(1)
#define CRO_PROGRAM_DATA (&CRO_BYTE(2))
#define CRM_PROGRAM_LEN 1
/* PROGRAM RESET */
#define CRO_PROGRAM_RESET_LEN 1
#define CRM_PROGRAM_RESET_LEN 1
/* GET_PGM_PROCESSOR_INFO*/
#define CRO_GET_PGM_PROCESSOR_INFO_LEN 1
#define CRM_GET_PGM_PROCESSOR_INFO_LEN 3
#define CRM_GET_PGM_PROCESSOR_INFO_PROPERTIES CRM_BYTE(1)
#define CRM_GET_PGM_PROCESSOR_INFO_MAX_SECTOR CRM_BYTE(2)
/* GET_SECTOR_INFO */
#define CRO_PROGRAM_GET_SECTOR_INFO_LEN 3
#define CRO_PROGRAM_GET_SECTOR_INFO_MODE CRO_BYTE(1)
#define CRO_PROGRAM_GET_SECTOR_INFO_NUMBER CRO_BYTE(2)
#define CRM_PROGRAM_GET_SECTOR_INFO_LEN 8
#define CRM_PROGRAM_GET_SECTOR_CLEAR_SEQ_NUM CRM_BYTE(1)
#define CRM_PROGRAM_GET_SECTOR_PGM_SEQ_NUM CRM_BYTE(2)
#define CRM_PROGRAM_GET_SECTOR_PGM_METHOD CRM_BYTE(3)
#define CRM_PROGRAM_GET_SECTOR_SECTOR_INFO CRM_DWORD(1)
#define CRM_PROGRAM_GET_SECTOR_SECTOR_INFO_WRITE(info) CRM_DWORD_WRITE(1, info)
/* PROGRAM_PREPARE */
#define CRO_PROGRAM_PREPARE_LEN 4
#define CRO_PROGRAM_PREPARE_SIZE CRO_WORD(1)
#define CRM_PROGRAM_PREPARE_LEN 1
/* PROGRAM_FORMAT */
#define CRO_PROGRAM_FORMAT_LEN 5
#define CRO_PROGRAM_FORMAT_COMPRESSION_METHOD CRO_BYTE(1)
#define CRO_PROGRAM_FORMAT_ENCRYPTION_METHOD CRO_BYTE(2)
#define CRO_PROGRAM_FORMAT_PROGRAMMING_METHOD CRO_BYTE(3)
#define CRO_PROGRAM_FORMAT_ACCESS_METHOD CRO_BYTE(4)
#define CRM_PROGRAM_FORMAT_LEN 1
/* PROGRAM_NEXT */
#define CRO_PROGRAM_NEXT_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-2))
#define CRO_PROGRAM_NEXT_LEN 2 /* + size */
#define CRO_PROGRAM_NEXT_SIZE CRO_BYTE(1)
#define CRO_PROGRAM_NEXT_DATA (&CRO_BYTE(2))
#define CRM_PROGRAM_NEXT_LEN 3
#define CRM_PROGRAM_NEXT_ERR_SEQUENCE CRM_BYTE(1)
#define CRM_PROGRAM_NEXT_SIZE_EXPECTED_DATA CRM_BYTE(2)
/* PROGRAM_MAX */
#define CRO_PROGRAM_MAX_MAX_SIZE ((uint8_t)(XCPTL_CTO_SIZE-1))
#define CRO_PROGRAM_MAX_DATA (&CRO_BYTE(1))
#define CRM_PROGRAM_MAX_LEN 1
/* PROGRAM_VERIFY */
#define CRO_PROGRAM_VERIFY_LEN 8
#define CRO_PROGRAM_VERIFY_MODE CRO_BYTE(1)
#define CRO_PROGRAM_VERIFY_TYPE CRO_WORD(1)
#define CRO_PROGRAM_VERIFY_VALUE CRO_DWORD(1)
#define CRM_PROGRAM_VERIFY_LEN 1
/* GET_SLAVE_ID */
#define CRO_GET_SLAVE_ID_LEN 6
#define CRO_GET_SLAVE_ID_SUB_CODE CRO_BYTE(1)
#define CRO_GET_SLAVE_ID_X CRO_BYTE(2)
#define CRO_GET_SLAVE_ID_C CRO_BYTE(3)
#define CRO_GET_SLAVE_ID_P CRO_BYTE(4)
#define CRO_GET_SLAVE_ID_MODE CRO_BYTE(5)
#define CRM_GET_SLAVE_ID_LEN 8
#define CRM_GET_SLAVE_ID_X CRM_BYTE(1)
#define CRM_GET_SLAVE_ID_C CRM_BYTE(2)
#define CRM_GET_SLAVE_ID_P CRM_BYTE(3)
#define CRM_GET_SLAVE_ID_CAN_ID_CMD_STIM CRM_DWORD(1)
/* GET_DAQ_ID */
#define CRO_GET_DAQ_ID_LEN 3
#define CRO_GET_DAQ_ID_SUB_CODE CRO_BYTE(1)
#define CRO_GET_DAQ_ID_DAQ CRO_WORD(1)
#define CRM_GET_DAQ_ID_LEN 8
#define CRM_GET_DAQ_ID_FIXED CRM_BYTE(1)
#define CRM_GET_DAQ_ID_ID CRM_DWORD(1)
/* SET_DAQ_ID */
#define CRO_SET_DAQ_ID_LEN 8
#define CRO_SET_DAQ_ID_SUB_CODE CRO_BYTE(1)
#define CRO_SET_DAQ_ID_DAQ CRO_WORD(1)
#define CRO_SET_DAQ_ID_ID CRO_DWORD(1)
#define CRM_SET_DAQ_ID_LEN 1
/* SET_SLAVE_PORT */
#define CRO_SET_SLAVE_PORT_LEN 4
#define CRO_SET_SLAVE_PORT_SUB_CODE CRO_BYTE(1)
#define CRO_SET_SLAVE_PORT_PORT CRO_WORD(1)
#define CRM_SET_SLAVE_PORT 1
/* Level 1 commands */
#define CRO_LEVEL_1_COMMAND_LEN 2
#define CRO_LEVEL_1_COMMAND_CODE CRO_BYTE(1)
/* GET_VERSION */
#define CRO_GET_VERSION_LEN 2
#define CRM_GET_VERSION_LEN 6
#define CRM_GET_VERSION_RESERVED CRM_BYTE(1)
#define CRM_GET_VERSION_PROTOCOL_VERSION_MAJOR CRM_BYTE(2)
#define CRM_GET_VERSION_PROTOCOL_VERSION_MINOR CRM_BYTE(3)
#define CRM_GET_VERSION_TRANSPORT_VERSION_MAJOR CRM_BYTE(4)
#define CRM_GET_VERSION_TRANSPORT_VERSION_MINOR CRM_BYTE(5)