1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-24 14:50:10 +01:00

p4io: change magic AA to P4IO_SOF

This commit is contained in:
Will Toohey 2021-04-06 20:23:01 +10:00
parent dbb8c45a9f
commit 53866130cb
3 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,8 @@
#include <stdint.h>
#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;

View File

@ -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;
}

View File

@ -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);