aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Host
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-09-28 12:14:06 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-09-28 12:14:06 +0000
commit713670043a1edb714461fc83c2b8817f3db99961 (patch)
tree9c45545908c0ad14ad8e136e34de00867fc569a7 /LUFA/Drivers/USB/Class/Host
parent800485bd95de4287006a0d0aa099bc510e929531 (diff)
downloadlufa-713670043a1edb714461fc83c2b8817f3db99961.tar.gz
lufa-713670043a1edb714461fc83c2b8817f3db99961.tar.bz2
lufa-713670043a1edb714461fc83c2b8817f3db99961.zip
Move out many of the common class driver constants into grouped enums, to make them more managable.
Add new CDC descriptor structs to the CDC class driver, so that the CDC demos can use human readable field names. Rename prefix for Still Image Host class driver functions from "SImage_" to "SI_" to remain consistent with the rest of the driver.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host')
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c8
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c26
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.h7
-rw-r--r--LUFA/Drivers/USB/Class/Host/HIDParser.c6
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c4
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c104
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h60
8 files changed, 107 insertions, 110 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index b9e4c9ebf..5a87c77ee 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -212,7 +212,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
USB_Request_Header_t Notification;
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
- if ((Notification.bRequest == NOTIF_SerialState) &&
+ if ((Notification.bRequest == CDC_NOTIF_SerialState) &&
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
{
Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
@@ -239,7 +239,7 @@ uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInf
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetLineEncoding,
+ .bRequest = CDC_REQ_SetLineEncoding,
.wValue = 0,
.wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,
.wLength = sizeof(CDCInterfaceInfo->State.LineEncoding),
@@ -255,7 +255,7 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCI
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetControlLineState,
+ .bRequest = CDC_REQ_SetControlLineState,
.wValue = CDCInterfaceInfo->State.ControlLineStates.HostToDevice,
.wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,
.wLength = 0,
@@ -272,7 +272,7 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SendBreak,
+ .bRequest = CDC_REQ_SendBreak,
.wValue = Duration,
.wIndex = CDCInterfaceInfo->State.ControlInterfaceNumber,
.wLength = 0,
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index 0642ecd40..bbb32cb55 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -62,12 +62,10 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
(CurrentHIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
HIDInterfaceInfo->State.InterfaceNumber = CurrentHIDInterface->InterfaceNumber;
- HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_NON_BOOT_PROTOCOL);
+ HIDInterfaceInfo->State.SupportsBootProtocol = (CurrentHIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData, DCOMP_HID_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
- {
- return HID_ENUMERROR_NoHIDDescriptorFound;
- }
+ return HID_ENUMERROR_NoHIDDescriptorFound;
HIDInterfaceInfo->State.HIDReportSize = DESCRIPTOR_CAST(ConfigDescriptorData, USB_HID_Descriptor_HID_t).HIDReportLength;
@@ -127,7 +125,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
static uint8_t DCOMP_HID_NextHID(void* const CurrentDescriptor)
{
- if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
+ if (DESCRIPTOR_TYPE(CurrentDescriptor) == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
return DESCRIPTOR_SEARCH_Fail;
@@ -161,10 +159,10 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetReport,
- .wValue = ((REPORT_ITEM_TYPE_In + 1) << 8) | ReportID,
+ .bRequest = HID_REQ_SetReport,
+ .wValue = ((HID_REPORT_ITEM_In + 1) << 8) | ReportID,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
- .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In),
+ .wLength = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In),
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -198,7 +196,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
*(BufferPos++) = ReportID;
}
- ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In);
+ ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In);
}
else
#endif
@@ -227,7 +225,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
return false;
- if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == REPORT_ITEM_TYPE_Out))
+ if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == HID_REPORT_ITEM_Out))
{
uint8_t ErrorCode;
@@ -251,7 +249,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetReport,
+ .bRequest = HID_REQ_SetReport,
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
.wValue = ((ReportType + 1) << 8) | ReportID,
#else
@@ -291,7 +289,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetProtocol,
+ .bRequest = HID_REQ_SetProtocol,
.wValue = 0,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
@@ -322,7 +320,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
.bRequest = REQ_GetDescriptor,
- .wValue = (DTYPE_Report << 8),
+ .wValue = (HID_DTYPE_Report << 8),
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = HIDInterfaceInfo->State.HIDReportSize,
};
@@ -337,7 +335,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SetProtocol,
+ .bRequest = HID_REQ_SetProtocol,
.wValue = 1,
.wIndex = HIDInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h
index 88d16640c..914d43278 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.h
+++ b/LUFA/Drivers/USB/Class/Host/HID.h
@@ -92,9 +92,8 @@
bool DataOUTPipeDoubleBank; /**< Indicates if the HID interface's OUT data pipe should use double banking. */
uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific
- * boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL,
- * \ref HID_BOOT_KEYBOARD_PROTOCOL or \ref HID_NON_BOOT_PROTOCOL if any
- * HID device should be enumerated by the interface.
+ * boot subclass protocol is required, a value from the \ref HID_BootProtocols_t
+ * enum.
*/
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
HID_ReportInfo_t* HIDParserData; /**< HID parser data to store the parsed HID report data, when boot protocol
@@ -212,7 +211,7 @@
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state.
* \param[in] ReportID Report ID of the report to send to the device, or 0 if the device does not use report IDs.
- * \param[in] ReportType Type of report to issue to the device, either \ref REPORT_ITEM_TYPE_Out or \ref REPORT_ITEM_TYPE_Feature.
+ * \param[in] ReportType Type of report to issue to the device, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature.
* \param[in] Buffer Buffer containing the report to send to the attached device.
* \param[in] ReportSize Report size in bytes to send to the attached device.
*
diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.c b/LUFA/Drivers/USB/Class/Host/HIDParser.c
index 49f9452ba..58ee00059 100644
--- a/LUFA/Drivers/USB/Class/Host/HIDParser.c
+++ b/LUFA/Drivers/USB/Class/Host/HIDParser.c
@@ -244,11 +244,11 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
uint8_t ItemTag = (HIDReportItem & TAG_MASK);
if (ItemTag == TAG_MAIN_INPUT)
- NewReportItem.ItemType = REPORT_ITEM_TYPE_In;
+ NewReportItem.ItemType = HID_REPORT_ITEM_In;
else if (ItemTag == TAG_MAIN_OUTPUT)
- NewReportItem.ItemType = REPORT_ITEM_TYPE_Out;
+ NewReportItem.ItemType = HID_REPORT_ITEM_Out;
else
- NewReportItem.ItemType = REPORT_ITEM_TYPE_Feature;
+ NewReportItem.ItemType = HID_REPORT_ITEM_Feature;
NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType];
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index dfa954c5c..0366703bb 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -284,7 +284,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
Pipe_ClearIN();
Pipe_Freeze();
- if (SCSICommandStatus->Status != SCSI_Command_Pass)
+ if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
return ErrorCode;
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c
index cddd5cbb5..b3d0f3070 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c
@@ -202,7 +202,7 @@ static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const R
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SendEncapsulatedCommand,
+ .bRequest = RNDIS_REQ_SendEncapsulatedCommand,
.wValue = 0,
.wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber,
.wLength = Length,
@@ -219,7 +219,7 @@ static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const R
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_GetEncapsulatedResponse,
+ .bRequest = RNDIS_REQ_GetEncapsulatedResponse,
.wValue = 0,
.wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber,
.wLength = Length,
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index e08fc76af..3883d3bad 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -36,9 +36,9 @@
#define __INCLUDE_FROM_SI_DRIVER
#include "StillImage.h"
-uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- uint16_t ConfigDescriptorSize,
- void* DeviceConfigDescriptor)
+uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ uint16_t ConfigDescriptorSize,
+ void* DeviceConfigDescriptor)
{
uint8_t FoundEndpoints = 0;
@@ -145,8 +145,8 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
-uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader)
+uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
@@ -176,8 +176,8 @@ uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceIn
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader)
+uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader)
{
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
@@ -226,7 +226,7 @@ uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfac
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
- if (PIMAHeader->Type == CType_ResponseBlock)
+ if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock)
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
@@ -241,9 +241,9 @@ uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfac
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- void* Buffer,
- const uint16_t Bytes)
+uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ void* Buffer,
+ const uint16_t Bytes)
{
uint8_t ErrorCode;
@@ -261,9 +261,9 @@ uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
return ErrorCode;
}
-uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- void* Buffer,
- const uint16_t Bytes)
+uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ void* Buffer,
+ const uint16_t Bytes)
{
uint8_t ErrorCode;
@@ -280,7 +280,7 @@ uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
return ErrorCode;
}
-bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
+bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
bool IsEventReceived = false;
@@ -298,8 +298,8 @@ bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
return IsEventReceived;
}
-uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader)
+uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
@@ -317,7 +317,7 @@ uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfac
return ErrorCode;
}
-uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
+uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
@@ -328,20 +328,20 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
SIInterfaceInfo->State.IsSessionOpen = false;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
- {
- .DataLength = PIMA_COMMAND_SIZE(1),
- .Type = CType_CommandBlock,
- .Code = 0x1002,
- .Params = {1},
- };
-
- if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ {
+ .DataLength = PIMA_COMMAND_SIZE(1),
+ .Type = SI_PIMA_CONTAINER_CommandBlock,
+ .Code = 0x1002,
+ .Params = {1},
+ };
+
+ if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
SIInterfaceInfo->State.IsSessionOpen = true;
@@ -349,7 +349,7 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
+uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
@@ -357,31 +357,31 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
- {
- .DataLength = PIMA_COMMAND_SIZE(1),
- .Type = CType_CommandBlock,
- .Code = 0x1003,
- .Params = {1},
- };
-
- if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ {
+ .DataLength = PIMA_COMMAND_SIZE(1),
+ .Type = SI_PIMA_CONTAINER_CommandBlock,
+ .Code = 0x1003,
+ .Params = {1},
+ };
+
+ if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
SIInterfaceInfo->State.IsSessionOpen = false;
- if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- const uint16_t Operation,
- const uint8_t TotalParams,
- uint32_t* const Params)
+uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ const uint16_t Operation,
+ const uint8_t TotalParams,
+ uint32_t* const Params)
{
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
@@ -389,21 +389,21 @@ uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)
- {
- .DataLength = PIMA_COMMAND_SIZE(TotalParams),
- .Type = CType_CommandBlock,
- .Code = Operation,
- };
+ {
+ .DataLength = PIMA_COMMAND_SIZE(TotalParams),
+ .Type = SI_PIMA_CONTAINER_CommandBlock,
+ .Code = Operation,
+ };
memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams);
- if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
return PIPE_RWSTREAM_NoError;
}
-uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
+uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
uint8_t ErrorCode;
SI_PIMA_Container_t PIMABlock;
@@ -411,10 +411,10 @@ uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceIn
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
- if ((ErrorCode = SImage_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
- if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))
+ if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
return PIPE_RWSTREAM_NoError;
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index a15091b6a..c215f1072 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -97,7 +97,7 @@
struct
{
bool IsActive; /**< Indicates if the current interface instance is connected to an attached device, valid
- * after \ref SImage_Host_ConfigurePipes() is called and the Host state machine is in the
+ * after \ref SI_Host_ConfigurePipes() is called and the Host state machine is in the
* Configured state.
*/
@@ -114,7 +114,7 @@
} USB_ClassInfo_SI_Host_t;
/* Enums: */
- /** Enum for the possible error codes returned by the \ref SImage_Host_ConfigurePipes() function. */
+ /** Enum for the possible error codes returned by the \ref SI_Host_ConfigurePipes() function. */
enum SIHost_EnumerationFailure_ErrorCodes_t
{
SI_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */
@@ -140,9 +140,9 @@
*
* \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum.
*/
- uint8_t SImage_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- uint16_t ConfigDescriptorSize,
- void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
+ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ uint16_t ConfigDescriptorSize,
+ void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands
* are issued to the device. Only one session can be open at the one time.
@@ -155,7 +155,7 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure.
*/
- uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated
* PIMA commands have been issued to the device.
@@ -168,7 +168,7 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure.
*/
- uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a raw PIMA block header to the device, filling out the transaction ID automatically. This can be used to send
* arbitrary PIMA blocks to the device with or without parameters.
@@ -181,9 +181,9 @@
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
- uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
- ATTR_NON_NULL_PTR_ARG(2);
+ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
+ ATTR_NON_NULL_PTR_ARG(2);
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
* or without parameters.
@@ -196,9 +196,9 @@
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
- uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
- ATTR_NON_NULL_PTR_ARG(2);
+ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
+ ATTR_NON_NULL_PTR_ARG(2);
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
*
@@ -213,10 +213,10 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure.
*/
- uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- const uint16_t Operation,
- const uint8_t TotalParams,
- uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1);
+ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ const uint16_t Operation,
+ const uint8_t TotalParams,
+ uint32_t* const Params) ATTR_NON_NULL_PTR_ARG(1);
/** Receives and checks a response block from the attached PIMA device, once a command has been issued and all data
* associated with the command has been transferred.
@@ -229,7 +229,7 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure.
*/
- uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe.
*
@@ -240,7 +240,7 @@
*
* \return Boolean true if an event is waiting to be read, false otherwise.
*/
- bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Receives an asynchronous event block from the device via the asynchronous events pipe.
*
@@ -253,9 +253,9 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure.
*/
- uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
- ATTR_NON_NULL_PTR_ARG(2);
+ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
+ ATTR_NON_NULL_PTR_ARG(2);
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
@@ -269,9 +269,9 @@
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
- uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- void* Buffer,
- const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ void* Buffer,
+ const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
@@ -285,9 +285,9 @@
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
- uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
- void* Buffer,
- const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
+ void* Buffer,
+ const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/* Inline Functions: */
/** General management task for a given Still Image host class interface, required for the correct operation of the
@@ -296,8 +296,8 @@
*
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state.
*/
- static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
- static inline void SImage_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
+ static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
(void)SIInterfaceInfo;
}