Fix KeyboardHost ClassDriver demo; boot protocol keyboard report structure in the Host Mode HID Class driver uses the full keycode array from the attached device.
{\r
USB_KeyboardReport_Data_t KeyboardReport;\r
uint8_t ReportID = 0;\r
- \r
+ \r
HID_Host_ReceiveReport(&Keyboard_HID_Interface, false, &ReportID, &KeyboardReport);\r
\r
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);\r
\r
- if (KeyboardReport.KeyCode)\r
+ uint8_t PressedKeyCode = KeyboardReport.KeyCode[0];\r
+\r
+ if (PressedKeyCode)\r
{\r
char PressedKey = 0;\r
\r
LEDs_ToggleLEDs(LEDS_LED2);\r
\r
/* Retrieve pressed key character if alphanumeric */\r
- if ((KeyboardReport.KeyCode >= 0x04) && (KeyboardReport.KeyCode <= 0x1D))\r
- PressedKey = (KeyboardReport.KeyCode - 0x04) + 'A';\r
- else if ((KeyboardReport.KeyCode >= 0x1E) && (KeyboardReport.KeyCode <= 0x27))\r
- PressedKey = (KeyboardReport.KeyCode - 0x1E) + '0';\r
- else if (KeyboardReport.KeyCode == 0x2C)\r
+ if ((PressedKeyCode >= 0x04) && (PressedKeyCode <= 0x1D))\r
+ PressedKey = (PressedKeyCode - 0x04) + 'A';\r
+ else if ((PressedKeyCode >= 0x1E) && (PressedKeyCode <= 0x27))\r
+ PressedKey = (PressedKeyCode - 0x1E) + '0';\r
+ else if (PressedKeyCode == 0x2C)\r
PressedKey = ' '; \r
- else if (KeyboardReport.KeyCode == 0x28)\r
+ else if (PressedKeyCode == 0x28)\r
PressedKey = '\n';\r
\r
if (PressedKey)\r
* and code generation features of the compiler. Attributes may be placed in the function prototype in any\r
* order, and multiple attributes can be specified for a single function via a space separated list.\r
*\r
+ * On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are\r
+ * critical to the code's function and thus must throw a compiler error when used.\r
+ *\r
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's\r
* functionality.\r
*/\r
\r
/* Public Interface - May be used in end-application: */\r
/* Macros: */\r
- /** Indicates to the compiler that the function can not ever return, so that any stack restoring or\r
- * return code may be omitted by the compiler in the resulting binary.\r
- */\r
- #define ATTR_NO_RETURN __attribute__ ((noreturn))\r
+ #if __GNUC__ >= 3\r
+ /** Indicates to the compiler that the function can not ever return, so that any stack restoring or\r
+ * return code may be omitted by the compiler in the resulting binary.\r
+ */\r
+ #define ATTR_NO_RETURN __attribute__ ((noreturn))\r
+ \r
+ /** Indicates that the function returns a value which should not be ignored by the user code. When\r
+ * applied, any ignored return value from calling the function will produce a compiler warning.\r
+ */\r
+ #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))\r
+\r
+ /** Indicates that the specified parameters of the function are pointers which should never be NULL.\r
+ * When applied as a 1-based comma separated list the compiler will emit a warning if the specified\r
+ * parameters are known at compiler time to be NULL at the point of calling the function.\r
+ */\r
+ #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))\r
+\r
+ /** Removes any preamble or postamble from the function. When used, the function will not have any\r
+ * register or stack saving code. This should be used with caution, and when used the programmer\r
+ * is responsible for maintaining stack and register integrity.\r
+ */\r
+ #define ATTR_NAKED __attribute__ ((naked))\r
+ \r
+ /** Prevents the compiler from considering a specified function for inlining. When applied, the given\r
+ * function will not be inlined under any circumstances.\r
+ */\r
+ #define ATTR_NO_INLINE __attribute__ ((noinline))\r
+\r
+ /** Forces the compiler to inline the specified function. When applied, the given function will be\r
+ * inlined under all circumstances.\r
+ */\r
+ #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))\r
+ \r
+ /** Indicates that the specified function is pure, in that it has no side-effects other than global\r
+ * or parameter variable access.\r
+ */\r
+ #define ATTR_PURE __attribute__ ((pure))\r
+ \r
+ /** Indicates that the specified function is constant, in that it has no side effects other than\r
+ * parameter access.\r
+ */\r
+ #define ATTR_CONST __attribute__ ((const))\r
+ \r
+ /** Marks a given function as deprecated, which produces a warning if the function is called. */\r
+ #define ATTR_DEPRECATED __attribute__ ((deprecated))\r
+ \r
+ /** Marks a function as a weak reference, which can be overridden by other functions with an\r
+ * identical name (in which case the weak reference is discarded at link time).\r
+ */\r
+ #define ATTR_WEAK __attribute__ ((weak))\r
+ #endif\r
\r
/** Places the function in one of the initialization sections, which execute before the main function\r
* of the application. The init function number can be specified as "x", as an integer. Refer to the\r
*/\r
#define ATTR_INIT_SECTION(x) __attribute__ ((naked, section (".init" #x )))\r
\r
- /** Indicates that the function returns a value which should not be ignored by the user code. When\r
- * applied, any ignored return value from calling the function will produce a compiler warning.\r
- */\r
- #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))\r
-\r
- /** Indicates that the specified parameters of the function are pointers which should never be NULL.\r
- * When applied as a 1-based comma separated list the compiler will emit a warning if the specified\r
- * parameters are known at compiler time to be NULL at the point of calling the function.\r
- */\r
- #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))\r
-\r
- /** Removes any preamble or postamble from the function. When used, the function will not have any\r
- * register or stack saving code. This should be used with caution, and when used the programmer\r
- * is responsible for maintaining stack and register integrity.\r
- */\r
- #define ATTR_NAKED __attribute__ ((naked))\r
- \r
- /** Prevents the compiler from considering a specified function for inlining. When applied, the given\r
- * function will not be inlined under any circumstances.\r
- */\r
- #define ATTR_NO_INLINE __attribute__ ((noinline))\r
-\r
- /** Forces the compiler to inline the specified function. When applied, the given function will be\r
- * inlined under all circumstances.\r
- */\r
- #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))\r
- \r
- /** Indicates that the specified function is pure, in that it has no side-effects other than global\r
- * or parameter variable access.\r
- */\r
- #define ATTR_PURE __attribute__ ((pure))\r
- \r
- /** Indicates that the specified function is constant, in that it has no side effects other than\r
- * parameter access.\r
- */\r
- #define ATTR_CONST __attribute__ ((const))\r
- \r
- /** Marks a given function as deprecated, which produces a warning if the function is called. */\r
- #define ATTR_DEPRECATED __attribute__ ((deprecated))\r
- \r
- /** Marks a function as a weak reference, which can be overridden by other functions with an\r
- * identical name (in which case the weak reference is discarded at link time).\r
- */\r
- #define ATTR_WEAK __attribute__ ((weak))\r
- \r
/** Marks a function as an alias for another function of name "x". */\r
#define ATTR_ALIAS(x) __attribute__ ((alias( #x )))\r
- \r
#endif\r
\r
/** @} */\r
#define INCLUDE_FROM_CDC_CLASS_HOST_C\r
#include "CDC.h"\r
\r
-uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t ConfigDescriptorSize,\r
+uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* ConfigDescriptorData)\r
{\r
uint8_t FoundEndpoints = 0;\r
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
-void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))\r
return;\r
Pipe_Freeze();\r
}\r
\r
-uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)\r
{\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding);\r
}\r
\r
-uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)\r
{\r
USB_ControlRequest = (USB_Request_Header_t)\r
{\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
-uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Data, uint16_t Length)\r
+uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, char* Data, const uint16_t Length)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))\r
return PIPE_READYWAIT_NoError;\r
return ErrorCode;\r
}\r
\r
-uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Data)\r
+uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Data)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))\r
return PIPE_READYWAIT_NoError;;\r
return PIPE_READYWAIT_NoError;\r
}\r
\r
-uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)\r
{\r
uint16_t BytesInPipe = 0;\r
\r
return BytesInPipe;\r
}\r
\r
-uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo)\r
+uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)\r
{\r
uint8_t ReceivedByte = 0;\r
\r
*\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state\r
*/\r
- void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Host interface configuration routine, to configure a given CDC host interface instance using the Configuration\r
* Descriptor read from an attached USB device. This function automatically updates the given CDC Host instance's\r
* the Addressed state.\r
*\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state\r
- * \param[in] ConfigDescriptorLength Length of the attached device's Configuration Descriptor\r
+ * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor\r
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor\r
*\r
* \return A value from the \ref CDCHost_EnumerationFailure_ErrorCodes_t enum\r
*/\r
- uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding\r
*\r
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum\r
*/\r
- uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Sends a Serial Control Line State Change notification to the device. This should be called when the virtual serial\r
* control lines (DTR, RTS, etc.) have changed states. Line states persist until they are cleared via a second\r
*\r
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum\r
*/\r
- uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Sends a given string to the attached USB device, if connected. If a device is not connected when the function is called, the\r
* string is discarded.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum\r
*/\r
- uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, char* Data, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1, 2);\r
+ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, char* Data, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1, 2);\r
\r
/** Sends a given byte to the attached USB device, if connected. If a host is not connected when the function is called, the\r
* byte is discarded.\r
*\r
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum\r
*/\r
- uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo, uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Determines the number of bytes received by the CDC interface from the device, waiting to be read.\r
*\r
*\r
* \return Total number of buffered bytes received from the device\r
*/\r
- uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** 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\r
* returns 0. The \ref CDC_Host_BytesReceived() function should be queried before data is received to ensure that no data\r
*\r
* \return Next received byte from the device, or 0 if no data received\r
*/\r
- uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** CDC class driver event for a control line state change on a CDC host interface. This event fires each time the device notifies\r
* the host of a control line state change (containing the virtual serial control line states, such as DCD) and may be hooked in the\r
*\r
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state\r
*/\r
- void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ void EVENT_CDC_Host_ControLineStateChanged(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
\r
#warning The HID Host mode Class driver is currently incomplete and is for preview purposes only.\r
\r
-uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint16_t ConfigDescriptorSize,\r
+uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* ConfigDescriptorData)\r
{\r
uint8_t FoundEndpoints = 0;\r
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
-void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)\r
+void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)\r
{\r
\r
}\r
\r
-uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, bool ControlRequest, uint8_t* ReportID, void* Buffer)\r
+uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, const bool ControlRequest,\r
+ uint8_t* ReportID, void* Buffer)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))\r
return false;\r
}\r
}\r
\r
-uint8_t HID_Host_SendReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint8_t ReportID, void* Buffer, uint16_t ReportSize)\r
+uint8_t HID_Host_SendReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint8_t ReportID, void* Buffer,\r
+ const uint16_t ReportSize)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))\r
return false;\r
}\r
}\r
\r
-bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)\r
+bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))\r
return false;\r
return ReportReceived;\r
}\r
\r
-uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)\r
+uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)\r
{\r
uint8_t ErrorCode;\r
\r
return HOST_SENDCONTROL_Successful;\r
}\r
\r
-uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo)\r
+uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)\r
{\r
uint8_t ErrorCode;\r
\r
*\r
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state\r
*/\r
- void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Host interface configuration routine, to configure a given HID host interface instance using the Configuration\r
* Descriptor read from an attached USB device. This function automatically updates the given HID Host instance's\r
* to either the \ref USB_HID_Host_SetBootProtocol() or \ref USB_HID_Host_SetReportProtocol() function.\r
*\r
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state\r
- * \param[in] ConfigDescriptorLength Length of the attached device's Configuration Descriptor\r
+ * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor\r
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor\r
*\r
* \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum\r
*/\r
- uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
\r
* \return An error code from the \ref USB_Host_SendControlErrorCodes_t enum if the ControlRequest flag is set,\r
* a value from the \ref Pipe_Stream_RW_ErrorCodes_t enum otherwise\r
*/\r
- uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, bool ControlRequest, uint8_t* ReportID,\r
+ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, const bool ControlRequest, uint8_t* ReportID,\r
void* Buffer) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Sends an OUT report to the currently attached HID device, using the device's OUT pipe if available or the device's\r
* \return An error code from the \ref USB_Host_SendControlErrorCodes_t enum if the DeviceUsesOUTPipe flag is set in\r
* the interface's state structure, a value from the \ref Pipe_Stream_RW_ErrorCodes_t enum otherwise\r
*/\r
- uint8_t HID_Host_SendReport(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo, uint8_t ReportID,\r
- void* Buffer, uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+ uint8_t HID_Host_SendReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, const uint8_t ReportID,\r
+ void* Buffer, const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Determines if a HID IN report has been received from the attached device on the data IN pipe.\r
*\r
*\r
* \return Boolean true if a report has been received, false otherwise\r
*/\r
- bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Switches the attached HID device's reporting protocol over to the Boot Report protocol mode, on supported devices.\r
*\r
* \return \ref HID_ERROR_LOGICAL if the device does not support Boot Protocol mode, a value from the\r
* \ref USB_Host_SendControlErrorCodes_t enum otherwise\r
*/\r
- uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Switches the attached HID device's reporting protocol over to the standard Report protocol mode. This also retrieves\r
* and parses the device's HID report descriptor, so that the size of each report can be determined in advance.\r
* not have a valid \ref HID_ReportInfo_t structure set in its configuration, a mask of \ref HID_ERROR_LOGICAL\r
* and a value from the \ref HID_Parse_ErrorCodes_t otherwise\r
*/\r
- uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
}\r
}\r
\r
-uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, uint8_t ReportID, uint8_t ReportType)\r
+uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, const uint8_t ReportID, const uint8_t ReportType)\r
{\r
for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++)\r
{\r
*\r
* \return Size of the report in bytes, or 0 if the report does not exist\r
*/\r
- uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, uint8_t ReportID,\r
- uint8_t ReportType) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, const uint8_t ReportID,\r
+ const uint8_t ReportType) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Callback routine for the HID Report Parser. This callback <b>must</b> be implemented by the user code when\r
* the parser is used, to determine what report IN, OUT and FEATURE item's information is stored into the user\r
#define INCLUDE_FROM_MS_CLASS_HOST_C\r
#include "MassStorage.h"\r
\r
-uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor)\r
{\r
uint8_t FoundEndpoints = 0;\r
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)\r
return MS_ENUMERROR_InvalidConfigDescriptor;\r
\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,\r
DComp_NextMSInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return MS_ENUMERROR_NoMSInterfaceFound;\r
\r
while (FoundEndpoints != (MS_FOUND_DATAPIPE_IN | MS_FOUND_DATAPIPE_OUT))\r
{\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,\r
DComp_NextMSInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return MS_ENUMERROR_EndpointsNotFound;\r
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
-void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* MSInterfaceInfo)\r
+void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)\r
{\r
\r
}\r
\r
-static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, MS_CommandBlockWrapper_t* SCSICommandBlock,\r
+static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t* const SCSICommandBlock,\r
void* BufferPtr)\r
{\r
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
return ErrorCode;\r
}\r
\r
-static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* MSInterfaceInfo)\r
+static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)\r
{\r
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;\r
\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo,\r
- MS_CommandBlockWrapper_t* SCSICommandBlock, void* BufferPtr)\r
+static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,\r
+ MS_CommandBlockWrapper_t* const SCSICommandBlock, void* BufferPtr)\r
{\r
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
uint16_t BytesRem = SCSICommandBlock->DataTransferLength;\r
return ErrorCode;\r
}\r
\r
-static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* MSInterfaceInfo,\r
- MS_CommandStatusWrapper_t* SCSICommandStatus)\r
+static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,\r
+ MS_CommandStatusWrapper_t* const SCSICommandStatus)\r
{\r
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;\r
\r
return ErrorCode;\r
}\r
\r
-uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* MSInterfaceInfo)\r
+uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return USB_Host_SendControlRequest(NULL);\r
}\r
\r
-uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* MaxLUNIndex)\r
+uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint8_t* const MaxLUNIndex)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return ErrorCode;\r
}\r
\r
-uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, SCSI_Inquiry_Response_t* InquiryData)\r
+uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Inquiry_Response_t* const InquiryData)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex)\r
+uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- SCSI_Capacity_t* DeviceCapacity)\r
+uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Capacity_t* const DeviceCapacity)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- SCSI_Request_Sense_Response_t* SenseData)\r
+uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Request_Sense_Response_t* const SenseData)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, bool PreventRemoval)\r
+uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ const bool PreventRemoval)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,\r
- uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer)\r
+uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, const uint32_t BlockAddress,\r
+ const uint8_t Blocks, const uint16_t BlockSize, void* BlockBuffer)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,\r
- uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer)\r
+uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex, const uint32_t BlockAddress,\r
+ const uint8_t Blocks, const uint16_t BlockSize, void* BlockBuffer)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
*\r
* \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state\r
*/\r
- void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ void MS_Host_USBTask(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Host interface configuration routine, to configure a given Mass Storage host interface instance using the\r
* Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass\r
* the host state machine is in the Addressed state.\r
*\r
* \param[in,out] MSInterfaceInfo Pointer to a structure containing an MS Class host configuration and state\r
- * \param[in] ConfigDescriptorLength Length of the attached device's Configuration Descriptor\r
+ * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor\r
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor\r
*\r
* \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum\r
*/\r
- uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface\r
*\r
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum\r
*/\r
- uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Sends a GET MAX LUN control request to the attached device, retrieving the index of the highest LUN (Logical\r
* UNit, a logical drive) in the device. This value can then be used in the other functions of the Mass Storage\r
*\r
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum\r
*/\r
- uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* MaxLUNIndex) ATTR_NON_NULL_PTR_ARG(1, 2);\r
+ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint8_t* const MaxLUNIndex) ATTR_NON_NULL_PTR_ARG(1, 2);\r
\r
/** Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and\r
* properties.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED\r
*/\r
- uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- SCSI_Inquiry_Response_t* InquiryData) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Inquiry_Response_t* const InquiryData) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Sends a TEST UNIT READY command to the device, to determine if it is ready to accept other SCSI commands.\r
*\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size.\r
*\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- SCSI_Capacity_t* DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Retrieves the device sense data, indicating the current device state and error codes for the previously\r
* issued command.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- SCSI_Request_Sense_Response_t* SenseData) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+ uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock\r
* the device from removal so that blocks of data on the medium can be read or altered.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex,\r
- bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Reads blocks of data from the attached Mass Storage device's medium.\r
*\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,\r
- uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1, 6);\r
+ uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize,\r
+ void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1, 6);\r
\r
/** Writes blocks of data to the attached Mass Storage device's medium.\r
*\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum or MS_ERROR_LOGICAL_CMD_FAILED if not ready\r
*/\r
- uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, uint32_t BlockAddress,\r
- uint8_t Blocks, uint16_t BlockSize, void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1, 6);\r
+ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, const uint8_t LUNIndex,\r
+ const uint32_t BlockAddress, const uint8_t Blocks, const uint16_t BlockSize,\r
+ void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1, 6);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
#define INCLUDE_FROM_SI_CLASS_HOST_C\r
#include "StillImage.h"\r
\r
-uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor)\r
{\r
uint8_t FoundEndpoints = 0;\r
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)\r
return SI_ENUMERROR_InvalidConfigDescriptor;\r
\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,\r
DComp_SI_Host_NextSIInterface) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return SI_ENUMERROR_NoSIInterfaceFound;\r
\r
while (FoundEndpoints != (SI_FOUND_EVENTS_IN | SI_FOUND_DATAPIPE_IN | SI_FOUND_DATAPIPE_OUT))\r
{\r
- if (USB_GetNextDescriptorComp(&ConfigDescriptorLength, &DeviceConfigDescriptor,\r
+ if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &DeviceConfigDescriptor,\r
DComp_SI_Host_NextSIInterfaceEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)\r
{\r
return SI_ENUMERROR_EndpointsNotFound;\r
return DESCRIPTOR_SEARCH_NotFound;\r
}\r
\r
-void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)\r
+void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)\r
{\r
\r
}\r
\r
-static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)\r
+static uint8_t SImage_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader)\r
{\r
uint8_t ErrorCode;\r
\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-static uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)\r
+static uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader)\r
{\r
uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;\r
\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)\r
+uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer, const uint16_t Bytes)\r
{\r
uint8_t ErrorCode;\r
\r
return ErrorCode;\r
}\r
\r
-uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes)\r
+uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer, const uint16_t Bytes)\r
{\r
uint8_t ErrorCode;\r
\r
return IsEventReceived;\r
}\r
\r
-uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, SI_PIMA_Container_t* PIMAHeader)\r
+uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader)\r
{\r
uint8_t ErrorCode;\r
\r
return ErrorCode;\r
}\r
\r
-uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)\r
+uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)\r
+uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t Operation,\r
- uint8_t TotalParams, uint32_t* Params)\r
+uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, const uint16_t Operation,\r
+ const uint8_t TotalParams, uint32_t* Params)\r
{\r
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))\r
return HOST_SENDCONTROL_DeviceDisconnect;\r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
-uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* SIInterfaceInfo)\r
+uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)\r
{\r
uint8_t ErrorCode;\r
SI_PIMA_Container_t PIMABlock;\r
*\r
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state\r
*/\r
- void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
\r
/** Host interface configuration routine, to configure a given Still Image host interface instance using the\r
* the host state machine is in the Addressed state.\r
*\r
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state\r
- * \param[in] ConfigDescriptorLength Length of the attached device's Configuration Descriptor\r
+ * \param[in] ConfigDescriptorSize Length of the attached device's Configuration Descriptor\r
* \param[in] DeviceConfigDescriptor Pointer to a buffer containing the attached device's Configuration Descriptor\r
*\r
* \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum\r
*/\r
- uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t ConfigDescriptorLength,\r
+ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
\r
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
* returned a logical command failure\r
*/\r
- uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated\r
* PIMA commands have been issued to the device.\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
* returned a logical command failure\r
*/\r
- uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Sends a given PIMA command to the attached device, filling out the PIMA command header automatically as required.\r
* \r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
* returned a logical command failure\r
*/\r
- uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, uint16_t Operation, uint8_t TotalParams,\r
- uint32_t* Params) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t SImage_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, const uint16_t Operation,\r
+ const uint8_t TotalParams, uint32_t* Params) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Receives and checks a response block from the attached PIMA device, once a command has been issued and all data\r
* associated with the command has been transferred.\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
* returned a logical command failure\r
*/\r
- uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ uint8_t SImage_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe.\r
*\r
*\r
* \return Boolean true if an event is waiting to be read, false otherwise\r
*/\r
- bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+ bool SImage_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
\r
/** Receives an asynchronous event block from the device via the asynchronous events pipe.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
* returned a logical command failure\r
*/\r
- uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* SIInterfaceInfo,\r
- SI_PIMA_Container_t* PIMAHeader) ATTR_NON_NULL_PTR_ARG(1, 2);\r
+ uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,\r
+ SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1, 2);\r
\r
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data\r
* transfer beyond the regular PIMA command block parameters.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum\r
*/\r
- uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1, 2);\r
+ uint8_t SImage_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer,\r
+ const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1, 2);\r
\r
/** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data\r
* transfer beyond the regular PIMA command block parameters.\r
*\r
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum\r
*/\r
- uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* SIInterfaceInfo, void* Buffer, uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1, 2);\r
+ uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer,\r
+ const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1, 2);\r
\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
}\r
}\r
\r
-bool Pipe_IsEndpointBound(uint8_t EndpointAddress)\r
+bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)\r
{\r
uint8_t PrevPipeNumber = Pipe_GetCurrentPipe();\r
\r
*\r
* \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise\r
*/\r
- bool Pipe_IsEndpointBound(uint8_t EndpointAddress);\r
+ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress);\r
\r
/** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host\r
* as needed. The last packet is not automatically discarded once the remaining bytes has been read; the\r