diff --git a/src/main/p4io/cmd.h b/src/main/p4io/cmd.h index b5c354a..ece1127 100644 --- a/src/main/p4io/cmd.h +++ b/src/main/p4io/cmd.h @@ -3,6 +3,8 @@ #include +#define P4IO_SOF 0xAA + enum p4ioemu_p4io_command { P4IO_CMD_INIT = 0x00, P4IO_CMD_GET_DEVICE_INFO = 0x01, @@ -23,7 +25,7 @@ enum p4ioemu_p4io_command { #define P4IO_MAX_PAYLOAD 60 struct p4io_cmd_header { - uint8_t AA; + uint8_t sof; uint8_t cmd; uint8_t seq_num; uint8_t payload_len; diff --git a/src/main/p4iodrv/usb.c b/src/main/p4iodrv/usb.c index 511336a..ca18109 100644 --- a/src/main/p4iodrv/usb.c +++ b/src/main/p4iodrv/usb.c @@ -118,7 +118,7 @@ bool p4io_usb_transfer( return false; } - cmd_buf.header.AA = 0xAA; + cmd_buf.header.sof = P4IO_SOF; cmd_buf.header.cmd = cmd; cmd_buf.header.seq_num = seq_no; cmd_buf.header.payload_len = req_payload_len; @@ -145,7 +145,7 @@ bool p4io_usb_transfer( memcpy(resp_payload, cmd_buf.payload, *resp_payload_len); *resp_payload_len = cmd_buf.header.payload_len; - if(cmd_buf.header.AA != 0xAA) { + if(cmd_buf.header.sof != P4IO_SOF) { log_warning("Response bad header"); return false; } diff --git a/src/main/p4ioemu/device.c b/src/main/p4ioemu/device.c index a3684ed..ee27e3b 100644 --- a/src/main/p4ioemu/device.c +++ b/src/main/p4ioemu/device.c @@ -141,7 +141,7 @@ static HRESULT p4ioemu_p4io_bulk_read(void *resp, uint32_t nbytes) payload_len = p4ioemu_p4io_cmd_buffer_resp_len; } - package->header.AA = 0xAA; + package->header.sof = P4IO_SOF; package->header.cmd = p4ioemu_p4io_last_cmd; package->header.seq_num = p4ioemu_p4io_last_seq_num; package->header.payload_len = payload_len; @@ -164,7 +164,7 @@ static HRESULT p4ioemu_p4io_bulk_write(const void *req, uint32_t nbytes) package = (struct p4io_cmd_package *) req; - if (package->header.AA != 0xAA) { + if (package->header.sof != P4IO_SOF) { log_warning("Command on bulk endpoint too short: %d", nbytes); p4ioemu_p4io_dump_buffer(req, nbytes);