Add optional pipe double banking support to the Host mode Class drivers.
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 7 Nov 2009 03:51:24 +0000 (03:51 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 7 Nov 2009 03:51:24 +0000 (03:51 +0000)
Descriptor processing routines now pass around void pointers rather than uint8_t pointers, as their destination datatype is know well known -- they are just streams of bytes until they are cast to the correct destination type by DESCRIPTOR_CAST.

25 files changed:
Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
Demos/Host/ClassDriver/MouseHost/MouseHost.c
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
LUFA/Drivers/USB/Class/Device/Audio.c
LUFA/Drivers/USB/Class/Host/CDC.c
LUFA/Drivers/USB/Class/Host/CDC.h
LUFA/Drivers/USB/Class/Host/HID.c
LUFA/Drivers/USB/Class/Host/HID.h
LUFA/Drivers/USB/Class/Host/MIDI.c
LUFA/Drivers/USB/Class/Host/MIDI.h
LUFA/Drivers/USB/Class/Host/MassStorage.c
LUFA/Drivers/USB/Class/Host/MassStorage.h
LUFA/Drivers/USB/Class/Host/Printer.c
LUFA/Drivers/USB/Class/Host/Printer.h
LUFA/Drivers/USB/Class/Host/StillImage.c
LUFA/Drivers/USB/Class/Host/StillImage.h
LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h
LUFA/Drivers/USB/LowLevel/DevChapter9.c

index 6695efa..76fb638 100644 (file)
@@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+\r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                                \r
                                .HIDInterfaceProtocol   = HID_NON_BOOT_PROTOCOL,\r
                                \r
index b483def..1b5f8c7 100644 (file)
@@ -45,7 +45,10 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+\r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                                \r
                                .HIDInterfaceProtocol   = HID_BOOT_KEYBOARD_PROTOCOL,\r
                        },\r
index bccfb8c..971dcf2 100644 (file)
@@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+\r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                                \r
                                .HIDInterfaceProtocol   = HID_NON_BOOT_PROTOCOL,\r
                                \r
index f575d8e..9a59be0 100644 (file)
@@ -45,7 +45,10 @@ USB_ClassInfo_MIDI_Host_t Keyboard_MIDI_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+                               \r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                        },\r
        };\r
 \r
index 1bb0a84..7489ad1 100644 (file)
@@ -45,7 +45,10 @@ USB_ClassInfo_MS_Host_t FlashDisk_MS_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+                               \r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                        },\r
        };\r
 \r
index fbf35c0..aa04c2e 100644 (file)
@@ -45,7 +45,10 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+                               \r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                                \r
                                .HIDInterfaceProtocol   = HID_BOOT_MOUSE_PROTOCOL,\r
                        },\r
index 80ddc55..022a102 100644 (file)
@@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+\r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                                \r
                                .HIDInterfaceProtocol   = HID_NON_BOOT_PROTOCOL,\r
                                \r
index f854e1b..f94bf63 100644 (file)
@@ -45,7 +45,10 @@ USB_ClassInfo_PRNT_Host_t Printer_PRNT_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+                               \r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
                        },\r
        };\r
 \r
index d8146af..2959af5 100644 (file)
@@ -45,8 +45,13 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
                .Config =\r
                        {\r
                                .DataINPipeNumber       = 1,\r
+                               .DataINPipeDoubleBank   = false,\r
+                               \r
                                .DataOUTPipeNumber      = 2,\r
+                               .DataOUTPipeDoubleBank  = false,\r
+                               \r
                                .EventsPipeNumber       = 3,\r
+                               .EventsPipeDoubleBank   = false,\r
                        },\r
        };\r
 \r
index 337437c..abc7546 100644 (file)
@@ -48,7 +48,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
                        {\r
                                Endpoint_ClearSETUP();\r
                                \r
-                               AudioInterfaceInfo->State.InterfaceEnabled = (USB_ControlRequest.wValue != 0);\r
+                               AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0);\r
                                  \r
                                Endpoint_ClearStatusStage();\r
                        }\r
index aac0931..db2f721 100644 (file)
@@ -35,7 +35,7 @@
 #include "CDC.h"\r
 \r
 uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                uint8_t* ConfigDescriptorData)\r
+                                void* ConfigDescriptorData)\r
 {\r
        uint8_t FoundEndpoints = 0;\r
 \r
index 4132d88..6b3a320 100644 (file)
                                const struct\r
                                {\r
                                        uint8_t  DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the CDC interface's IN data pipe should use double banking */\r
+\r
                                        uint8_t  DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the CDC interface's OUT data pipe should use double banking */\r
+\r
                                        uint8_t  NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */                   \r
+                                       bool     NotificationPipeDoubleBank; /** Indicates if the CDC interface's notification pipe should use double banking */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\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* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                                       uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+                                                       void* 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
                         *  values of the interface have been changed to push the new settings to the USB device.\r
index 7d6a6dc..7d9b3b5 100644 (file)
@@ -35,7 +35,7 @@
 #include "HID.h"\r
 \r
 uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                uint8_t* ConfigDescriptorData)\r
+                                void* ConfigDescriptorData)\r
 {\r
        uint8_t FoundEndpoints = 0;\r
 \r
@@ -84,7 +84,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
                if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
                {\r
                        Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,\r
-                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
+                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
+                                                          HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        HIDInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
                        \r
                        FoundEndpoints |= HID_FOUND_DATAPIPE_IN;\r
@@ -92,7 +93,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
                else\r
                {\r
                        Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,\r
-                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
+                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
+                                                          HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        HIDInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
                        \r
                        HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;\r
index a852f10..89cb3d8 100644 (file)
                                const struct\r
                                {\r
                                        uint8_t  DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the HID interface's IN data pipe should use double banking */\r
+\r
                                        uint8_t  DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the HID interface's OUT data pipe should use double banking */\r
 \r
                                        uint8_t  HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific\r
                                                                        *   boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL,\r
                         *  \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum\r
                         */\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
+                                                       void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
 \r
 \r
                        /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.\r
index 69118cd..5d3b148 100644 (file)
@@ -35,7 +35,7 @@
 #include "MIDI.h"\r
 \r
 uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                 uint8_t* ConfigDescriptorData)\r
+                                 void* ConfigDescriptorData)\r
 {\r
        uint8_t FoundEndpoints = 0;\r
 \r
@@ -63,7 +63,8 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
                if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
                {\r
                        Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
-                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
+                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
+                                                          MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        MIDIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
                        \r
                        FoundEndpoints |= MIDI_FOUND_DATAPIPE_IN;\r
@@ -71,7 +72,8 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
                else\r
                {\r
                        Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
-                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
+                                                          EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
+                                                          MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        MIDIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
 \r
                        FoundEndpoints |= MIDI_FOUND_DATAPIPE_OUT;\r
index 35671f9..cc294a4 100644 (file)
                                const struct\r
                                {\r
                                        uint8_t  DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the MIDI interface's IN data pipe should use double banking */\r
+                                       \r
                                        uint8_t  DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the MIDI interface's OUT data pipe should use double banking */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
                                           */\r
                         *  \return A value from the \ref MIDIHost_EnumerationFailure_ErrorCodes_t enum\r
                         */\r
                        uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                                        uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+                                                        void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
 \r
                        /** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded.\r
                         *\r
index 3251862..d1622c1 100644 (file)
@@ -35,7 +35,7 @@
 #include "MassStorage.h"\r
 \r
 uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                                          uint8_t* DeviceConfigDescriptor)\r
+                                                          void* DeviceConfigDescriptor)\r
 {\r
        uint8_t FoundEndpoints = 0;\r
        \r
@@ -66,7 +66,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u
                {\r
                        Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
                                           EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                          PIPE_BANK_DOUBLE);\r
+                                          MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        MSInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
 \r
                        FoundEndpoints |= MS_FOUND_DATAPIPE_IN;\r
@@ -75,7 +75,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u
                {\r
                        Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
                                           EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                          PIPE_BANK_DOUBLE);\r
+                                          MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        MSInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
 \r
                        FoundEndpoints |= MS_FOUND_DATAPIPE_OUT;\r
index a651a88..4cd37bd 100644 (file)
                        {\r
                                const struct\r
                                {\r
-                                       uint8_t  DataINPipeNumber; /**< Pipe number of the MS interface's IN data pipe */\r
-                                       uint8_t  DataOUTPipeNumber; /**< Pipe number of the MS interface's OUT data pipe */\r
+                                       uint8_t  DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the Mass Storage interface's IN data pipe should use double banking */\r
+\r
+                                       uint8_t  DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the Mass Storage interface's OUT data pipe should use double banking */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
                                           */\r
@@ -80,8 +83,8 @@
                                                        */\r
                                        uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device */\r
 \r
-                                       uint16_t DataINPipeSize; /**< Size in bytes of the MS interface's IN data pipe */\r
-                                       uint16_t DataOUTPipeSize;  /**< Size in bytes of the MS interface's OUT data pipe */\r
+                                       uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe */\r
+                                       uint16_t DataOUTPipeSize;  /**< Size in bytes of the Mass Storage interface's OUT data pipe */\r
                                        \r
                                        uint32_t TransactionTag; /**< Current transaction tag for data synchronising of packets */\r
                                } State; /**< State data for the USB class interface within the device. All elements in this section\r
                         *  \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum\r
                         */\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
+                                                      void* 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
                         *  and readying it for the next Mass Storage command.\r
index bc8fba8..192e17f 100644 (file)
@@ -35,7 +35,7 @@
 #include "Printer.h"\r
 \r
 uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                                            uint8_t* DeviceConfigDescriptor)\r
+                                                            void* DeviceConfigDescriptor)\r
 {\r
        uint8_t FoundEndpoints = 0;\r
        \r
@@ -69,7 +69,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
                {\r
                        Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
                                           EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                          PIPE_BANK_DOUBLE);\r
+                                          PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        PRNTInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
 \r
                        FoundEndpoints |= PRNT_FOUND_DATAPIPE_IN;\r
@@ -78,7 +78,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
                {\r
                        Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
                                           EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                          PIPE_BANK_DOUBLE);\r
+                                          PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                        PRNTInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
 \r
                        FoundEndpoints |= PRNT_FOUND_DATAPIPE_OUT;\r
index d61eb4a..34f8e4e 100644 (file)
                                const struct\r
                                {\r
                                        uint8_t  DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the Printer interface's IN data pipe should use double banking */\r
+\r
                                        uint8_t  DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the Printer interface's OUT data pipe should use double banking */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
                                           */\r
                         *  \return A value from the \ref PRNTHost_EnumerationFailure_ErrorCodes_t enum\r
                         */\r
                        uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                                        uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+                                                        void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
                        \r
                        /** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called\r
                         *  once the connected device's configuration has been set, to ensure the printer is ready to accept commands.\r
index f98f508..e809c92 100644 (file)
@@ -35,7 +35,7 @@
 #include "StillImage.h"\r
 \r
 uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                              uint8_t* DeviceConfigDescriptor)\r
+                               void* DeviceConfigDescriptor)\r
 {\r
        uint8_t  FoundEndpoints = 0;\r
        \r
@@ -66,7 +66,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
                        {\r
                                Pipe_ConfigurePipe(SIInterfaceInfo->Config.EventsPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,\r
                                                                   EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                                                  PIPE_BANK_DOUBLE);                   \r
+                                                                  SIInterfaceInfo->Config.EventsPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);                 \r
                                SIInterfaceInfo->State.EventsPipeSize = EndpointData->EndpointSize;\r
 \r
                                Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS);\r
@@ -80,7 +80,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
                        {\r
                                Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
                                                                   EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                                                  PIPE_BANK_DOUBLE);\r
+                                                                  SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                                SIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
 \r
                                FoundEndpoints |= SI_FOUND_DATAPIPE_IN;\r
@@ -89,7 +89,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
                        {\r
                                Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
                                                                   EndpointData->EndpointAddress, EndpointData->EndpointSize,\r
-                                                                  PIPE_BANK_DOUBLE);\r
+                                                                  SIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
                                SIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
 \r
                                FoundEndpoints |= SI_FOUND_DATAPIPE_OUT;\r
index 4f7f7fa..0493470 100644 (file)
                                const struct\r
                                {\r
                                        uint8_t  DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe */\r
+                                       bool     DataINPipeDoubleBank; /** Indicates if the Still Image interface's IN data pipe should use double banking */\r
+\r
                                        uint8_t  DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe */\r
+                                       bool     DataOUTPipeDoubleBank; /** Indicates if the Still Image interface's OUT data pipe should use double banking */\r
+\r
                                        uint8_t  EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used */                       \r
+                                       bool     EventsPipeDoubleBank; /** Indicates if the Still Image interface's events data pipe should use double banking */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\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* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,\r
-                                           uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);\r
+                                           void* 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
                         *  are issued to the device. Only one session can be open at the one time.\r
index 6b20f46..5857fba 100644 (file)
@@ -69,7 +69,7 @@ uint8_t USB_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const Conf
 #endif\r
 \r
 void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,\r
-                                 uint8_t** const CurrConfigLoc,\r
+                                 void** const CurrConfigLoc,\r
                                  const uint8_t Type)\r
 {\r
        while (*BytesRem)\r
@@ -82,7 +82,7 @@ void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
 }\r
 \r
 void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,\r
-                                       uint8_t** const CurrConfigLoc,\r
+                                       void** const CurrConfigLoc,\r
                                        const uint8_t Type,\r
                                        const uint8_t BeforeType)\r
 {\r
@@ -103,7 +103,7 @@ void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
 }\r
 \r
 void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,\r
-                                      uint8_t** const CurrConfigLoc,\r
+                                      void** const CurrConfigLoc,\r
                                       const uint8_t Type,\r
                                       const uint8_t AfterType)\r
 {\r
@@ -113,7 +113,7 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
          USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);\r
 }\r
                        \r
-uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)\r
+uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, void** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)\r
 {\r
        uint8_t ErrorCode;\r
                \r
index 9af0f60..6d57d2e 100644 (file)
                         *  }\r
                         *  \endcode\r
                         */\r
-                       uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);\r
+                       uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, void** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);\r
                        \r
                /* Enums: */\r
                        /** Enum for the possible return codes of the \ref USB_GetDeviceConfigDescriptor() function. */\r
                         * \param[in] Type  Descriptor type value to search for\r
                         */\r
                        void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,\r
-                                                        uint8_t** const CurrConfigLoc,\r
+                                                        void** const CurrConfigLoc,\r
                                                         const uint8_t Type)\r
                                                         ATTR_NON_NULL_PTR_ARG(1, 2);\r
 \r
                         * \param[in] BeforeType  Descriptor type value which must not be reached before the given Type descriptor\r
                         */\r
                        void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,\r
-                                                              uint8_t** const CurrConfigLoc,\r
+                                                              void** const CurrConfigLoc,\r
                                                               const uint8_t Type,\r
                                                               const uint8_t BeforeType)\r
                                                               ATTR_NON_NULL_PTR_ARG(1, 2);\r
                         * \param[in] AfterType  Descriptor type value which must be reached before the given Type descriptor\r
                         */\r
                        void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,\r
-                                                             uint8_t** const CurrConfigLoc,\r
+                                                             void** const CurrConfigLoc,\r
                                                              const uint8_t Type,\r
                                                              const uint8_t AfterType)\r
                                                              ATTR_NON_NULL_PTR_ARG(1, 2);\r
                         * \param[in,out] CurrConfigLoc  Pointer to the current descriptor inside the configuration descriptor\r
                         */\r
                        static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,\r
-                                                                uint8_t** const CurrConfigLoc) \r
+                                                                void** const CurrConfigLoc) \r
                                                                 ATTR_NON_NULL_PTR_ARG(1, 2);                                                                     \r
                        static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,\r
-                                                                uint8_t** const CurrConfigLoc)\r
+                                                                void** const CurrConfigLoc)\r
                        {\r
                                uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;\r
 \r
index 89c4e29..bb6104f 100644 (file)
@@ -228,7 +228,7 @@ static void USB_Device_GetInternalSerialDescriptor(void)
        SignatureDescriptor.Header.Size  = sizeof(SignatureDescriptor);\r
        SignatureDescriptor.Header.Type  = DTYPE_String;\r
        \r
-       uint8_t  SigReadAddress     = 0x0E;\r
+       uint8_t  SigReadAddress = 0x0E;\r
 \r
        for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)\r
        {\r
@@ -314,7 +314,7 @@ static void USB_Device_GetStatus(void)
                        break;\r
 #if !defined(CONTROL_ONLY_DEVICE)\r
                case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):\r
-                       Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex);\r
+                       Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);\r
 \r
                        CurrentStatus = Endpoint_IsStalled();\r
 \r