aboutsummaryrefslogtreecommitdiffstats
path: root/Demos
diff options
context:
space:
mode:
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c16
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.c34
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c4
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h6
4 files changed, 24 insertions, 36 deletions
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
index 468a04ab7..2e5adbac3 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
@@ -239,8 +239,6 @@ static void SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* MSInterfaceI
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
- return;
}
/** Command processing for an issued SCSI READ (10) or WRITE (10) command. This command reads in the block start address
@@ -255,15 +253,11 @@ static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo
uint32_t BlockAddress;
uint16_t TotalBlocks;
- /* Load in the 32-bit block address (SCSI uses big-endian, so have to do it byte-by-byte) */
- ((uint8_t*)&BlockAddress)[3] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[2];
- ((uint8_t*)&BlockAddress)[2] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[3];
- ((uint8_t*)&BlockAddress)[1] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
- ((uint8_t*)&BlockAddress)[0] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[5];
+ /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
+ BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
- /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to do it byte-by-byte) */
- ((uint8_t*)&TotalBlocks)[1] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[7];
- ((uint8_t*)&TotalBlocks)[0] = MSInterfaceInfo->State.CommandBlock.SCSICommandData[8];
+ /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
+ TotalBlocks = SwapEndian_16(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= LUN_MEDIA_BLOCKS)
@@ -289,6 +283,4 @@ static void SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* MSInterfaceInfo
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
- return;
}
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c
index c41b5777f..f9ec4a840 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.c
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c
@@ -141,7 +141,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearSETUP();
/* Indicate that the current transfer should be aborted */
- IsMassStoreReset = true;
+ IsMassStoreReset = true;
Endpoint_ClearStatusStage();
}
@@ -204,19 +204,6 @@ void MassStorage_Task(void)
/* Return command status block to the host */
ReturnCommandStatus();
-
- /* Check if a Mass Storage Reset occurred */
- if (IsMassStoreReset)
- {
- /* Reset the data endpoint banks */
- Endpoint_ResetFIFO(MASS_STORAGE_OUT_EPNUM);
- Endpoint_ResetFIFO(MASS_STORAGE_IN_EPNUM);
-
- Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
- Endpoint_ClearStall();
- Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
- Endpoint_ClearStall();
- }
/* Indicate ready */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -228,8 +215,23 @@ void MassStorage_Task(void)
}
}
- /* Clear the abort transfer flag */
- IsMassStoreReset = false;
+ /* Check if a Mass Storage Reset occurred */
+ if (IsMassStoreReset)
+ {
+ /* Reset the data endpoint banks */
+ Endpoint_ResetFIFO(MASS_STORAGE_OUT_EPNUM);
+ Endpoint_ResetFIFO(MASS_STORAGE_IN_EPNUM);
+
+ Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
+ Endpoint_ClearStall();
+ Endpoint_ResetDataToggle();
+ Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
+ Endpoint_ClearStall();
+ Endpoint_ResetDataToggle();
+
+ /* Clear the abort transfer flag */
+ IsMassStoreReset = false;
+ }
}
/** Function to read in a command block from the host, via the bulk data OUT endpoint. This function reads in the next command block
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
index 3c82eee7c..921f3a9f8 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
@@ -165,12 +165,12 @@ void ReadNextReport(void)
*
* \param[in] ReportOUTData Buffer containing the report to send to the device
* \param[in] ReportIndex Index of the report in the device (zero if the device does not use multiple reports)
- * \param[in] ReportType Type of report to send, either HID_REPORTTYPE_OUTPUT or HID_REPORTTYPE_FEATURE
+ * \param[in] ReportType Type of report to send, either REPORT_ITEM_TYPE_Out or REPORT_ITEM_TYPE_Feature
* \param[in] ReportLength Length of the report to send
*/
void WriteNextReport(uint8_t* ReportOUTData, uint8_t ReportIndex, uint8_t ReportType, uint16_t ReportLength)
{
- /* Select and unfreeze HID data OUT pipe */
+ /* Select the HID data OUT pipe */
Pipe_SelectPipe(HID_DATA_OUT_PIPE);
/* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
index 4a64b5791..3395e3278 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
@@ -61,12 +61,6 @@
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
-
- /** HID Report type specifier, for output reports to a device */
- #define HID_REPORTTYPE_OUTPUT 0x02
-
- /** HID Report type specifier, for feature reports to a device */
- #define HID_REPORTTYPE_FEATURE 0x03
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1