Added new \ref SPI_GetCurrentMode() function to the SPI peripheral driver.
[pub/USBasp.git] / Demos / Device / ClassDriver / VirtualSerialMassStorage / Lib / SCSI.c
index 78783f0..d7842c5 100644 (file)
@@ -154,8 +154,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
 static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)\r
 {\r
        uint16_t AllocationLength  = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[3]);\r
-       uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :\r
-                                                                              sizeof(InquiryData);\r
+       uint16_t BytesTransferred  = MIN(AllocationLength, sizeof(InquiryData));\r
 \r
        /* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */\r
        if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||\r
@@ -193,7 +192,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
 static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)\r
 {\r
        uint8_t  AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];\r
-       uint8_t  BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);\r
+       uint8_t  BytesTransferred = MIN(AllocationLength, sizeof(SenseData));\r
 \r
        Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NULL);\r
        Endpoint_Null_Stream((AllocationLength - BytesTransferred), NULL);\r
@@ -335,10 +334,10 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
 static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)\r
 {\r
        /* Send an empty header response with the Write Protect flag status */\r
-       Endpoint_Write_Byte(0x00);\r
-       Endpoint_Write_Byte(0x00);\r
-       Endpoint_Write_Byte(DISK_READ_ONLY ? 0x80 : 0x00);\r
-       Endpoint_Write_Byte(0x00);\r
+       Endpoint_Write_8(0x00);\r
+       Endpoint_Write_8(0x00);\r
+       Endpoint_Write_8(DISK_READ_ONLY ? 0x80 : 0x00);\r
+       Endpoint_Write_8(0x00);\r
        Endpoint_ClearIN();\r
 \r
        /* Update the bytes transferred counter and succeed the command */\r