aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Demos/Host/ClassDriver/StillImageHost/StillImageHost.c22
-rw-r--r--Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c2
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c4
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h6
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.c8
-rw-r--r--LUFA/Drivers/USB/Class/Common/StillImage.h2
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h2
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c20
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.h10
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c8
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.h8
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c120
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.h8
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c89
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h31
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h2
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.h2
-rw-r--r--LUFA/ManPages/ChangeLog.txt2
-rw-r--r--LUFA/ManPages/FutureChanges.txt1
-rw-r--r--LUFA/ManPages/MigrationInformation.txt2
20 files changed, 202 insertions, 147 deletions
diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
index deb8a5504..d60db097b 100644
--- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
+++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
@@ -50,7 +50,6 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
},
};
-
/** Main program entry point. This routine configures the hardware required by the application, then
* starts the scheduler to run the application tasks.
*/
@@ -102,7 +101,28 @@ int main(void)
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
+ printf("Opening Session...\r\n");
+
+ if (SImage_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
+ {
+ printf("Could not open PIMA session.\r\n");
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ printf("Closing Session...\r\n");
+
+ if (SImage_Host_CloseSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
+ {
+ printf("Could not close PIMA session.\r\n");
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
+ break;
+ }
+
+ printf("Device Idle.\r\n");
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
index fefcbbfc7..7ed8898e3 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
@@ -30,7 +30,7 @@
/** \file
*
- * Printer Device commands, to send/recieve data to and from an attached USB
+ * Printer Device commands, to send/receive data to and from an attached USB
* printer, and to send and receive Printer Class control requests.
*/
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
index fbff2f48c..31b5e002d 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
@@ -80,7 +80,7 @@ void SImage_SendBlockHeader(void)
}
/** Function to receive a PIMA event container from the attached still image device. */
-uint8_t SImage_RecieveEventHeader(void)
+uint8_t SImage_ReceiveEventHeader(void)
{
uint8_t ErrorCode;
@@ -101,7 +101,7 @@ uint8_t SImage_RecieveEventHeader(void)
}
/** Function to receive a PIMA response container from the attached still image device. */
-uint8_t SImage_RecieveBlockHeader(void)
+uint8_t SImage_ReceiveBlockHeader(void)
{
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
index b44b7524f..6ac70fc50 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
@@ -85,7 +85,7 @@
uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */
uint16_t Code; /**< Command, event or response code of the container */
uint32_t TransactionID; /**< Unique container ID to link blocks together */
- uint32_t Params[4]; /**< Block parameters to be issued along with the block code (command blocks only) */
+ uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} PIMA_Container_t;
/* Enums: */
@@ -106,8 +106,8 @@
/* Function Prototypes: */
void SImage_SendBlockHeader(void);
- uint8_t SImage_RecieveBlockHeader(void);
- uint8_t SImage_RecieveEventHeader(void);
+ uint8_t SImage_ReceiveBlockHeader(void);
+ uint8_t SImage_ReceiveEventHeader(void);
uint8_t SImage_SendData(void* Buffer, uint16_t Bytes);
uint8_t SImage_ReadData(void* Buffer, uint16_t Bytes);
bool SImage_IsEventReceived(void);
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
index fb768fdaa..75a293469 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
@@ -189,7 +189,7 @@ void StillImage_Task(void)
SImage_SendBlockHeader();
/* Receive the response data block */
- if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
@@ -242,7 +242,7 @@ void StillImage_Task(void)
printf_P(PSTR(" Device Version: %s\r\n"), DeviceVersion);
/* Receive the final response block from the device */
- if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
@@ -274,7 +274,7 @@ void StillImage_Task(void)
SImage_SendBlockHeader();
/* Receive the response block from the device */
- if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
@@ -306,7 +306,7 @@ void StillImage_Task(void)
SImage_SendBlockHeader();
/* Receive the response block from the device */
- if ((ErrorCode = SImage_RecieveBlockHeader()) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h
index 84dee7156..690b1bb18 100644
--- a/LUFA/Drivers/USB/Class/Common/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Common/StillImage.h
@@ -117,7 +117,7 @@
uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */
uint16_t Code; /**< Command, event or response code of the container */
uint32_t TransactionID; /**< Unique container ID to link blocks together */
- uint32_t Params[4]; /**< Block parameters to be issued along with the block code (command blocks only) */
+ uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} SI_PIMA_Container_t;
/* Disable C linkage for C++ Compilers: */
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index dcb1762bd..5905474ce 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -180,7 +180,7 @@
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function
- * returns 0. The \ref CDC_Device_BytesReceived() function should be queried before data is recieved to ensure that no data
+ * returns 0. The \ref CDC_Device_BytesReceived() function should be queried before data is received to ensure that no data
* underflow occurs.
*
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index cb70808a1..68dddeacb 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -131,7 +131,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint
}
}
- CDCInterfaceInfo->State.Active = true;
+ CDCInterfaceInfo->State.IsActive = true;
return CDC_ENUMERROR_NoError;
}
@@ -196,7 +196,7 @@ static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* CurrentDescriptor)
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
@@ -258,7 +258,7 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfa
uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Data, uint16_t Length)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
uint8_t ErrorCode;
@@ -273,10 +273,10 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Da
uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Data)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
- uint8_t ErrorCode = PIPE_READYWAIT_NoError;
+ uint8_t ErrorCode;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
@@ -284,20 +284,22 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Da
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearOUT();
- ErrorCode = Pipe_WaitUntilReady();
+
+ if ((ErrorCode = Pipe_WaitUntilReady()) != PIPE_READYWAIT_NoError)
+ return ErrorCode;
}
Pipe_Write_Byte(Data);
Pipe_Freeze();
- return ErrorCode;
+ return PIPE_READYWAIT_NoError;
}
uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
{
uint16_t BytesInPipe = 0;
- if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return BytesInPipe;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
@@ -316,7 +318,7 @@ uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)
{
uint8_t ReceivedByte = 0;
- if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return ReceivedByte;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h
index 99fbdbbd3..de4b6afd4 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.h
+++ b/LUFA/Drivers/USB/Class/Host/CDC.h
@@ -71,10 +71,10 @@
*/
struct
{
- bool Active; /**< Indicates if the current interface instance is connected to an attached device, valid
- * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
- * Configured state
- */
+ bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
+ * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
+ * Configured state
+ */
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device */
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe */
@@ -187,7 +187,7 @@
uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function
- * returns 0. The \ref CDC_Host_BytesReceived() function should be queried before data is recieved to ensure that no data
+ * returns 0. The \ref CDC_Host_BytesReceived() function should be queried before data is received to ensure that no data
* underflow occurs.
*
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index f9c42b281..15106cee1 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -99,7 +99,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint
}
}
- HIDInterfaceInfo->State.Active = true;
+ HIDInterfaceInfo->State.IsActive = true;
return HID_ENUMERROR_NoError;
}
@@ -142,11 +142,11 @@ void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)
{
- bool ReportReceived;
-
- if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
return false;
+ bool ReportReceived;
+
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h
index 48cdcb03b..dd4a7537f 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.h
+++ b/LUFA/Drivers/USB/Class/Host/HID.h
@@ -76,10 +76,10 @@
*/
struct
{
- bool Active; /**< Indicates if the current interface instance is connected to an attached device, valid
- * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
- * Configured state
- */
+ bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
+ * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
+ * Configured state
+ */
uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device */
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe */
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index 678c070c0..a812fa975 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -87,7 +87,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_
}
}
- MSInterfaceInfo->State.Active = true;
+ MSInterfaceInfo->State.IsActive = true;
return MS_ENUMERROR_NoError;
}
@@ -290,7 +290,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* MSInterfaceInf
uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* MSInterfaceInfo)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
USB_ControlRequest = (USB_Request_Header_t)
@@ -309,7 +309,7 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* MSInterfaceInfo)
uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* MaxLUNIndex)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
uint8_t ErrorCode;
@@ -332,15 +332,15 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* Max
*MaxLUNIndex = 0;
}
- return ErrorCode;
+ return HOST_SENDCONTROL_SetupStalled;
}
uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, SCSI_Inquiry_Response_t* InquiryData)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -363,26 +363,20 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, InquiryData)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -405,27 +399,21 @@ uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,
SCSI_Capacity_t* DeviceCapacity)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -452,30 +440,24 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uin
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
DeviceCapacity->Blocks = SwapEndian_32(DeviceCapacity->Blocks);
DeviceCapacity->BlockSize = SwapEndian_32(DeviceCapacity->BlockSize);
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,
SCSI_Request_Sense_Response_t* SenseData)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -498,26 +480,20 @@ uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t L
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, SenseData)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, bool PreventRemoval)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -540,27 +516,21 @@ uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* MSInterfaceIn
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,
uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -587,27 +557,21 @@ uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,
uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer)
{
- if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.Active))
+ if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnect;
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
@@ -634,18 +598,12 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
- {
- Pipe_Freeze();
- return ErrorCode;
- }
+ return ErrorCode;
- return ErrorCode;
+ return PIPE_RWSTREAM_NoError;
}
#endif
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h
index 9fc8851b5..ff2e9019e 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h
@@ -73,10 +73,10 @@
*/
struct
{
- bool Active; /**< Indicates if the current interface instance is connected to an attached device, valid
- * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
- * Configured state
- */
+ bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
+ * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
+ * Configured state
+ */
uint8_t InterfaceNumber; /**< Interface index of the HID interface within the attached device */
uint16_t DataINPipeSize; /**< Size in bytes of the MS interface's IN data pipe */
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index 40ef4f23e..a3b150848 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -99,6 +99,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_
}
}
+ SIInterfaceInfo->State.IsActive = true;
return SI_ENUMERROR_NoError;
}
@@ -148,27 +149,39 @@ void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
}
-void SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
+static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
{
+ uint8_t ErrorCode;
+
+ if (SIInterfaceInfo->State.IsSessionOpen)
+ PIMAHeader->TransactionID = SIInterfaceInfo->State.TransactionID++;
+ else
+ PIMAHeader->TransactionID = 0;
+
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
- Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
+ if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
if (PIMAHeader->Type == CType_CommandBlock)
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
if (ParamBytes)
- Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK);
-
- Pipe_ClearOUT();
+ {
+ if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+ }
}
-
+
+ Pipe_ClearOUT();
Pipe_Freeze();
+
+ return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_RecieveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
+static uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
{
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
@@ -231,7 +244,7 @@ uint8_t SImage_Host_RecieveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)
+static uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)
{
uint8_t ErrorCode;
@@ -246,7 +259,7 @@ uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buf
return ErrorCode;
}
-uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)
+static uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)
{
uint8_t ErrorCode;
@@ -260,7 +273,7 @@ uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buf
return ErrorCode;
}
-bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
+static bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
{
bool IsEventReceived = false;
@@ -275,7 +288,7 @@ bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
return IsEventReceived;
}
-uint8_t SImage_Host_RecieveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
+static uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)
{
uint8_t ErrorCode;
@@ -290,4 +303,58 @@ uint8_t SImage_Host_RecieveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,
return ErrorCode;
}
+uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
+{
+ if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
+ return HOST_SENDCONTROL_DeviceDisconnect;
+
+ uint8_t ErrorCode;
+
+ SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
+ {
+ .DataLength = PIMA_COMMAND_SIZE(0),
+ .Type = CType_CommandBlock,
+ .Code = 0x1002,
+ .Params = {},
+ };
+
+ SIInterfaceInfo->State.TransactionID = 1;
+
+ if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ SIInterfaceInfo->State.IsSessionOpen = true;
+
+ return PIPE_RWSTREAM_NoError;
+}
+
+uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)
+{
+ if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
+ return HOST_SENDCONTROL_DeviceDisconnect;
+
+ uint8_t ErrorCode;
+
+ SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
+ {
+ .DataLength = PIMA_COMMAND_SIZE(0),
+ .Type = CType_CommandBlock,
+ .Code = 0x1003,
+ .Params = {},
+ };
+
+ if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ return ErrorCode;
+
+ SIInterfaceInfo->State.IsSessionOpen = false;
+
+ return PIPE_RWSTREAM_NoError;
+}
+
#endif
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index 4d3779603..7e33fc4b1 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -67,14 +67,17 @@
*/
struct
{
- bool Active; /**< Indicates if the current interface instance is connected to an attached device, valid
- * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
- * Configured state
- */
+ bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
+ * after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the
+ * Configured state
+ */
uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe */
uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe */
+
+ bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device */
+ uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
@@ -120,13 +123,9 @@
uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t ConfigDescriptorLength,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
- void SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader);
- uint8_t SImage_Host_RecieveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader);
- uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes);
- uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes);
- bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
- uint8_t SImage_Host_RecieveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader);
-
+ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
+ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
@@ -144,6 +143,16 @@
#if defined(INCLUDE_FROM_SI_CLASS_HOST_C)
static uint8_t DComp_SI_Host_NextSIInterface(void* CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DComp_SI_Host_NextSIInterfaceEndpoint(void* CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
+
+ static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,
+ SI_PIMA_Container_t* PIMAHeader);
+ static uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,
+ SI_PIMA_Container_t* PIMAHeader);
+ static uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes);
+ static uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes);
+ static bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo);
+ static uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,
+ SI_PIMA_Container_t* PIMAHeader);
#endif
#endif
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index 652ee8042..2fa20dfe7 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -33,7 +33,7 @@
*
* Functions, macros and enums related to endpoint management when in USB Device mode. This
* module contains the endpoint management macros, as well as endpoint interrupt and data
- * send/recieve functions for various data types.
+ * send/receive functions for various data types.
*
* @{
*/
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h
index 1057ec8bc..294545804 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.h
@@ -32,7 +32,7 @@
* @defgroup Group_PipeManagement Pipe Management
*
* This module contains functions, macros and enums related to pipe management when in USB Host mode. This
- * module contains the pipe management macros, as well as pipe interrupt and data send/recieve functions
+ * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions
* for various data types.
*
* @{
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 75ea01624..60f00ed15 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -490,7 +490,7 @@
* - CDC demos now send empty packets after sending a full one to prevent buffering issues on the host
* - Updated demo descriptors to use VID/PID values donated by Atmel
* - Added DoxyGen documentation to the source files
- * - Fixed Serial_IsCharRecieved() definition, was previously reversed
+ * - Fixed Serial_IsCharReceived() definition, was previously reversed
* - Removed separate USB_Descriptor_Language_t descriptor, USB_Descriptor_String_t is used instead
* - Removed unused Device Qualifier descriptor structure
* - Renamed the USB_CreateEndpoints event to the more appropriate USB_ConfigurationChanged
diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt
index 8d394435a..fe6523d66 100644
--- a/LUFA/ManPages/FutureChanges.txt
+++ b/LUFA/ManPages/FutureChanges.txt
@@ -13,7 +13,6 @@
*
* <b>Targeted for This Release:</b>
* - Finish HID and Still Image Host Mode Class Drivers, add demo summaries
- * - Add overviews of each of the officially supported boards to the manual
* - Re-add in flip, flip-ee, dfu and dfu-ee targets to project makefiles
* - Add in new invalid event hook check targets to project makefiles
* - Fix allowable F_CPU values comment in project makefiles
diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt
index a38c27b48..c098e130d 100644
--- a/LUFA/ManPages/MigrationInformation.txt
+++ b/LUFA/ManPages/MigrationInformation.txt
@@ -243,7 +243,7 @@
* as it is neither a full nor a standards compliant implementation.
*
* <b>Non-USB Library Components</b>
- * - The Serial_IsCharRecieved() macro has been changed to the correct spelling of Serial_IsCharReceived() in Serial.h.
+ * - The Serial_IsCharReceived() macro has been changed to the correct spelling of Serial_IsCharReceived() in Serial.h.
*
* <b>Device Mode</b>
* - The MANUAL_PLL_CONTROL compile time token has been removed, and replaced with a USB_OPT_MANUAL_PLL mask