if (PipeNum == AudioInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_ISOCHRONOUS;
}
else if (PipeNum == AudioInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_ISOCHRONOUS;
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
}
else if (PipeNum == CDCInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
}
else if (PipeNum == CDCInterfaceInfo->Config.NotificationPipeNumber)
{
- Size = NotificationEndpoint->EndpointSize;
+ Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
EndpointAddress = NotificationEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
if (DataOUTEndpoint == NULL)
continue;
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_INTERRUPT;
}
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
- HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
+ HIDInterfaceInfo->State.HIDReportSize = LE16_TO_CPU(HIDDescriptor->HIDReportLength);
HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_CSCP_NonBootProtocol);
HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.IsActive = true;
{
uint8_t ErrorCode;
+ if (!(HIDInterfaceInfo->State.SupportsBootProtocol))
+ return HID_ERROR_LOGICAL;
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
Pipe_SelectPipe(PIPE_CONTROLPIPE);
- if (!(HIDInterfaceInfo->State.SupportsBootProtocol))
- return HID_ERROR_LOGICAL;
-
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
}
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
}
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
if (++MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF)
MSInterfaceInfo->State.TransactionTag = 1;
- SCSICommandBlock->Signature = MS_CBW_SIGNATURE;
- SCSICommandBlock->Tag = MSInterfaceInfo->State.TransactionTag;
+ SCSICommandBlock->Signature = CPU_TO_LE32(MS_CBW_SIGNATURE);
+ SCSICommandBlock->Tag = cpu_to_le32(MSInterfaceInfo->State.TransactionTag);
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
void* BufferPtr)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
- uint16_t BytesRem = SCSICommandBlock->DataTransferLength;
+ uint16_t BytesRem = le32_to_cpu(SCSICommandBlock->DataTransferLength);
if (SCSICommandBlock->Flags & MS_COMMAND_DIR_DATA_IN)
{
Pipe_SelectPipe(PIPE_CONTROLPIPE);
- if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
+ if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) == HOST_SENDCONTROL_SetupStalled)
{
*MaxLUNIndex = 0;
ErrorCode = HOST_SENDCONTROL_Successful;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = sizeof(SCSI_Inquiry_Response_t),
+ .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Inquiry_Response_t)),
.Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = 0,
+ .DataTransferLength = CPU_TO_LE32(0),
.Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = sizeof(SCSI_Capacity_t),
+ .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Capacity_t)),
.Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 10,
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- SwapEndian_n(&DeviceCapacity->Blocks, sizeof(DeviceCapacity->Blocks));
- SwapEndian_n(&DeviceCapacity->BlockSize, sizeof(DeviceCapacity->BlockSize));
+ DeviceCapacity->Blocks = BE32_TO_CPU(DeviceCapacity->Blocks);
+ DeviceCapacity->BlockSize = BE32_TO_CPU(DeviceCapacity->BlockSize);
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = sizeof(SCSI_Request_Sense_Response_t),
+ .DataTransferLength = CPU_TO_LE32(sizeof(SCSI_Request_Sense_Response_t)),
.Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = 0,
+ .DataTransferLength = CPU_TO_LE32(0),
.Flags = MS_COMMAND_DIR_DATA_OUT,
.LUN = LUNIndex,
.SCSICommandLength = 6,
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = ((uint32_t)Blocks * BlockSize),
+ .DataTransferLength = cpu_to_le32((uint32_t)Blocks * BlockSize),
.Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 10,
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .DataTransferLength = ((uint32_t)Blocks * BlockSize),
+ .DataTransferLength = cpu_to_le32((uint32_t)Blocks * BlockSize),
.Flags = MS_COMMAND_DIR_DATA_OUT,
.LUN = LUNIndex,
.SCSICommandLength = 10,
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
}
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
return USB_Host_SendControlRequest(PortStatus);
}
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
return USB_Host_SendControlRequest(NULL);
}
return HOST_SENDCONTROL_Successful;
}
- DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength);
+ DeviceIDStringLength = be16_to_cpu(DeviceIDStringLength);
if (DeviceIDStringLength > BufferSize)
DeviceIDStringLength = BufferSize;
if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
{
- Size = DataINEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataINEndpoint->EndpointSize);
EndpointAddress = DataINEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_BULK;
}
else if (PipeNum == RNDISInterfaceInfo->Config.DataOUTPipeNumber)
{
- Size = DataOUTEndpoint->EndpointSize;
+ Size = le16_to_cpu(DataOUTEndpoint->EndpointSize);
EndpointAddress = DataOUTEndpoint->EndpointAddress;
Token = PIPE_TOKEN_OUT;
Type = EP_TYPE_BULK;
}
else if (PipeNum == RNDISInterfaceInfo->Config.NotificationPipeNumber)
{
- Size = NotificationEndpoint->EndpointSize;
+ Size = le16_to_cpu(NotificationEndpoint->EndpointSize);
EndpointAddress = NotificationEndpoint->EndpointAddress;
Token = PIPE_TOKEN_IN;
Type = EP_TYPE_INTERRUPT;
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
return USB_Host_SendControlRequest(Buffer);
}
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
return USB_Host_SendControlRequest(Buffer);
}
RNDIS_KeepAlive_Message_t KeepAliveMessage;
RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse;
- KeepAliveMessage.MessageType = REMOTE_NDIS_KEEPALIVE_MSG;
- KeepAliveMessage.MessageLength = sizeof(RNDIS_KeepAlive_Message_t);
- KeepAliveMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
+ KeepAliveMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_KEEPALIVE_MSG);
+ KeepAliveMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_KeepAlive_Message_t));
+ KeepAliveMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &KeepAliveMessage,
sizeof(RNDIS_KeepAlive_Message_t))) != HOST_SENDCONTROL_Successful)
RNDIS_Initialize_Message_t InitMessage;
RNDIS_Initialize_Complete_t InitMessageResponse;
- InitMessage.MessageType = REMOTE_NDIS_INITIALIZE_MSG;
- InitMessage.MessageLength = sizeof(RNDIS_Initialize_Message_t);
- InitMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
+ InitMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_INITIALIZE_MSG);
+ InitMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Initialize_Message_t));
+ InitMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++);
- InitMessage.MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
- InitMessage.MinorVersion = REMOTE_NDIS_VERSION_MINOR;
- InitMessage.MaxTransferSize = RNDISInterfaceInfo->Config.HostMaxPacketSize;
+ InitMessage.MajorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MAJOR);
+ InitMessage.MinorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MINOR);
+ InitMessage.MaxTransferSize = cpu_to_le32(RNDISInterfaceInfo->Config.HostMaxPacketSize);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &InitMessage,
sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful)
return ErrorCode;
}
- if (InitMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
+ if (InitMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS))
return RNDIS_ERROR_LOGICAL_CMD_FAILED;
- RNDISInterfaceInfo->State.DeviceMaxPacketSize = InitMessageResponse.MaxTransferSize;
+ RNDISInterfaceInfo->State.DeviceMaxPacketSize = le32_to_cpu(InitMessageResponse.MaxTransferSize);
return HOST_SENDCONTROL_Successful;
}
RNDIS_Set_Complete_t SetMessageResponse;
- SetMessageData.SetMessage.MessageType = REMOTE_NDIS_SET_MSG;
- SetMessageData.SetMessage.MessageLength = sizeof(RNDIS_Set_Message_t) + Length;
- SetMessageData.SetMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
+ SetMessageData.SetMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_SET_MSG);
+ SetMessageData.SetMessage.MessageLength = cpu_to_le32(sizeof(RNDIS_Set_Message_t) + Length);
+ SetMessageData.SetMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++);
- SetMessageData.SetMessage.Oid = Oid;
- SetMessageData.SetMessage.InformationBufferLength = Length;
- SetMessageData.SetMessage.InformationBufferOffset = (sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
- SetMessageData.SetMessage.DeviceVcHandle = 0;
+ SetMessageData.SetMessage.Oid = cpu_to_le32(Oid);
+ SetMessageData.SetMessage.InformationBufferLength = cpu_to_le32(Length);
+ SetMessageData.SetMessage.InformationBufferOffset = CPU_TO_LE32(sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
+ SetMessageData.SetMessage.DeviceVcHandle = CPU_TO_LE32(0);
memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length);
return ErrorCode;
}
- if (SetMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
+ if (SetMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS))
return RNDIS_ERROR_LOGICAL_CMD_FAILED;
return HOST_SENDCONTROL_Successful;
uint8_t ContiguousBuffer[MaxLength];
} QueryMessageResponseData;
- QueryMessage.MessageType = REMOTE_NDIS_QUERY_MSG;
- QueryMessage.MessageLength = sizeof(RNDIS_Query_Message_t);
- QueryMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
+ QueryMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_QUERY_MSG);
+ QueryMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Query_Message_t));
+ QueryMessage.RequestId = cpu_to_le32(RNDISInterfaceInfo->State.RequestID++);
- QueryMessage.Oid = Oid;
- QueryMessage.InformationBufferLength = 0;
- QueryMessage.InformationBufferOffset = 0;
- QueryMessage.DeviceVcHandle = 0;
+ QueryMessage.Oid = cpu_to_le32(Oid);
+ QueryMessage.InformationBufferLength = CPU_TO_LE32(0);
+ QueryMessage.InformationBufferOffset = CPU_TO_LE32(0);
+ QueryMessage.DeviceVcHandle = CPU_TO_LE32(0);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &QueryMessage,
sizeof(RNDIS_Query_Message_t))) != HOST_SENDCONTROL_Successful)
return ErrorCode;
}
- if (QueryMessageResponseData.QueryMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
+ if (QueryMessageResponseData.QueryMessageResponse.Status != CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS))
return RNDIS_ERROR_LOGICAL_CMD_FAILED;
memcpy(Buffer, &QueryMessageResponseData.ContiguousBuffer, MaxLength);
return ErrorCode;
}
- *PacketLength = (uint16_t)DeviceMessage.DataLength;
+ *PacketLength = (uint16_t)le32_to_cpu(DeviceMessage.DataLength);
Pipe_Discard_Stream(DeviceMessage.DataOffset -
(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
RNDIS_Packet_Message_t DeviceMessage;
memset(&DeviceMessage, 0, sizeof(RNDIS_Packet_Message_t));
- DeviceMessage.MessageType = REMOTE_NDIS_PACKET_MSG;
- DeviceMessage.MessageLength = (sizeof(RNDIS_Packet_Message_t) + PacketLength);
- DeviceMessage.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
- DeviceMessage.DataLength = PacketLength;
+ DeviceMessage.MessageType = CPU_TO_LE32(REMOTE_NDIS_PACKET_MSG);
+ DeviceMessage.MessageLength = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) + PacketLength);
+ DeviceMessage.DataOffset = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
+ DeviceMessage.DataLength = cpu_to_le32(PacketLength);
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
return PIPE_RWSTREAM_DeviceDisconnected;
if (SIInterfaceInfo->State.IsSessionOpen)
- PIMAHeader->TransactionID = SIInterfaceInfo->State.TransactionID++;
+ PIMAHeader->TransactionID = cpu_to_le32(SIInterfaceInfo->State.TransactionID++);
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NULL);
- if (PIMAHeader->Type == PIMA_CONTAINER_ResponseBlock)
+ if (PIMAHeader->Type == CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock))
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
- .DataLength = PIMA_COMMAND_SIZE(1),
- .Type = PIMA_CONTAINER_CommandBlock,
- .Code = 0x1002,
- .Params = {1},
+ .DataLength = CPU_TO_LE32(PIMA_COMMAND_SIZE(1)),
+ .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock),
+ .Code = CPU_TO_LE16(0x1002),
+ .Params = {CPU_TO_LE32(1)},
};
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001)))
return SI_ERROR_LOGICAL_CMD_FAILED;
SIInterfaceInfo->State.IsSessionOpen = true;
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
- .DataLength = PIMA_COMMAND_SIZE(1),
- .Type = PIMA_CONTAINER_CommandBlock,
- .Code = 0x1003,
- .Params = {1},
+ .DataLength = CPU_TO_LE32(PIMA_COMMAND_SIZE(1)),
+ .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock),
+ .Code = CPU_TO_LE16(0x1003),
+ .Params = {CPU_TO_LE32(1)},
};
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
SIInterfaceInfo->State.IsSessionOpen = false;
- if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001)))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;
PIMA_Container_t PIMABlock = (PIMA_Container_t)
{
- .DataLength = PIMA_COMMAND_SIZE(TotalParams),
- .Type = PIMA_CONTAINER_CommandBlock,
- .Code = Operation,
+ .DataLength = cpu_to_le32(PIMA_COMMAND_SIZE(TotalParams)),
+ .Type = CPU_TO_LE16(PIMA_CONTAINER_CommandBlock),
+ .Code = cpu_to_le16(Operation),
};
memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams);
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((PIMABlock.Type != PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != CPU_TO_LE16(PIMA_CONTAINER_ResponseBlock)) || (PIMABlock.Code != CPU_TO_LE16(0x2001)))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;