class ModifyBits(Packet): # Modify bits fields_desc = [ ByteField("shift_value", 0), XCPEndiannessField(ShortField("and_mask", 0)), XCPEndiannessField(ShortField("xor_mask", 0)) ]
class ProgramClear(Packet): """Clear a part of non-volatile memory""" access_mode = {0x00: "absolute_access", 0x01: "functional_access"} fields_desc = [ ByteEnumField("mode", 0, access_mode), XCPEndiannessField(ShortField("reserved", 0)), XCPEndiannessField(IntField("clear_range", 0)) ]
class TransportLayerCmdSetDAQId(Packet): sub_command = { 0xFD: "SET_DAQ_ID", } fields_desc = [ XCPEndiannessField(ShortField("daq_list_number", 0)), XCPEndiannessField(IntField("can_identifier", 0)) ]
class BuildChecksum(Packet): # Build checksum over memory range fields_desc = [ # specification says: position 1-3 type byte The example(Part 5 # Example Communication Sequences ) shows 3 bytes for "reserved" # http://read.pudn.com/downloads192/doc/comm/903802/XCP%20-Part%205-%20Example%20Communication%20Sequences%20-1.0.pdf # noqa: E501 # --> 3 bytes XCPEndiannessField(ThreeBytesField("reserved", 0)), XCPEndiannessField(XIntField("block_size", 0)) ]
class SetDaqListMode(Packet): """Set mode for DAQ list""" fields_desc = [ FlagsField("mode", 0, 8, [ "x0", "direction", "x2", "x3", "timestamp", "pid_off", "x6", "x7" ]), XCPEndiannessField(ShortField("daq_list_num", 0)), XCPEndiannessField(ShortField("event_channel_num", 0)), ByteField("transmission_rate_prescaler", 0), ByteField("daq_list_prio", 0) ]
class ProgramVerify(Packet): """Program Verify""" start_mode = { 0x00: "request_to_start_internal_routine", 0x01: "sending_verification_value" } fields_desc = [ ByteEnumField("verification_mode", 0, start_mode), XCPEndiannessField(ShortField("verification_type", 0)), XCPEndiannessField(IntField("verification_value", 0)) ]
class SetMta(Packet): # Set Memory Transfer Address in slave fields_desc = [ # specification says: position 1,2 type byte (not WORD) The example( # Part 5 Example Communication Sequences ) shows 2 bytes for # "reserved" # http://read.pudn.com/downloads192/doc/comm/903802/XCP%20-Part%205-%20Example%20Communication%20Sequences%20-1.0.pdf # noqa: E501 # --> 2 bytes XCPEndiannessField(ShortField("reserved", 0)), ByteField("address_extension", 0), XCPEndiannessField(XIntField("address", 0)) ]
class StartStopDaqList(Packet): """Start/stop/select DAQ list""" mode_enum = {0x00: "stop", 0x01: "start", 0x02: "select"} fields_desc = [ ByteEnumField("mode", 0, mode_enum), XCPEndiannessField(ShortField("daq_list_number", 0)) ]
class AllocOdt(Packet): """Allocate ODTs to a DAQ list""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_num", 0)), ByteField("odt_count", 0) ]
class WriteDaq(Packet): """Data acquisition and stimulation, static, mandatory""" fields_desc = [ ByteField("bit_offset", 0), ByteField("size_of_daq_element", 0), ByteField("address_extension", 0), XCPEndiannessField(IntField("address", 0)) ]
class SetDaqPtr(Packet): """Data acquisition and stimulation, static, mandatory""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_num", 0)), ByteField("odt_num", 0), ByteField("odt_entry_num", 0) ]
class ShortUpload(Packet): # Upload from slave to master (short version) fields_desc = [ ByteField("nr_of_data_elements", 0), ByteField("reserved", 0), XByteField("address_extension", 0), XCPEndiannessField(IntField("address", 0)) ]
class AllocOdtEntry(Packet): """Allocate ODT entries to an ODT""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_num", 0)), ByteField("odt_num", 0), ByteField("odt_entries_count", 0) ]
class SetRequest(Packet): """Request to save to non-volatile memory""" fields_desc = [ FlagsField("mode", 0, 8, [ "store_cal_req", "store_daq_req", "clear_daq_req", "x3", "x4", "x5", "x6", "x7" ]), XCPEndiannessField(ShortField("session_configuration_id", 0x00)) ]
class ShortDownload(Packet): # Download from master to slave (short version) fields_desc = [ FieldLenField("len", None, length_of="data_elements", fmt="B"), ByteField("reserved", 0), ByteField("address_extension", 0), XCPEndiannessField(IntField("address", 0)), StrVarLenField("data_elements", b"", length_from=lambda p: p.len, max_length=lambda: get_max_cto() - 8) ]
class GetDaqListInfo(Packet): """Get specific information for a DAQ list""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_num", 0)) ]
class TransportLayerCmdGetDAQId(Packet): fields_desc = [ XCPEndiannessField(ShortField("daq_list_number", 0)), ]
class ProgramPrepare(Packet): """Prepare non-volatile memory programming""" fields_desc = [ ByteField("not_used", 0), XCPEndiannessField(ShortField("code_size", 0)) ]
class GetDaqListMode(Packet): """Get mode from DAQ list""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_number", 0)) ]
class AllocDaq(Packet): """Allocate DAQ lists""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_count", 0)) ]
class ClearDaqList(Packet): """Clear DAQ list configuration""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("daq_list_num", 0)) ]
class GetDaqEventInfo(Packet): """Get specific information for an event channel""" fields_desc = [ ByteField("reserved", 0), XCPEndiannessField(ShortField("event_channel_num", 0)) ]