Add optional pipe double banking support to the Host mode Class drivers.

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.
pull/1469/head
Dean Camera 15 years ago
parent f29fc1abc4
commit 64e5c4084f

@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL, .HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,

@ -45,7 +45,10 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_BOOT_KEYBOARD_PROTOCOL, .HIDInterfaceProtocol = HID_BOOT_KEYBOARD_PROTOCOL,
}, },

@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL, .HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,

@ -45,7 +45,10 @@ USB_ClassInfo_MIDI_Host_t Keyboard_MIDI_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
}, },
}; };

@ -45,7 +45,10 @@ USB_ClassInfo_MS_Host_t FlashDisk_MS_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
}, },
}; };

@ -45,7 +45,10 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL, .HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL,
}, },

@ -48,7 +48,10 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL, .HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,

@ -45,7 +45,10 @@ USB_ClassInfo_PRNT_Host_t Printer_PRNT_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
}, },
}; };

@ -45,8 +45,13 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
.Config = .Config =
{ {
.DataINPipeNumber = 1, .DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2, .DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.EventsPipeNumber = 3, .EventsPipeNumber = 3,
.EventsPipeDoubleBank = false,
}, },
}; };

@ -48,7 +48,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
{ {
Endpoint_ClearSETUP(); Endpoint_ClearSETUP();
AudioInterfaceInfo->State.InterfaceEnabled = (USB_ControlRequest.wValue != 0); AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0);
Endpoint_ClearStatusStage(); Endpoint_ClearStatusStage();
} }

@ -35,7 +35,7 @@
#include "CDC.h" #include "CDC.h"
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* ConfigDescriptorData) void* ConfigDescriptorData)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;

@ -64,8 +64,13 @@
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the CDC interface's IN data pipe */
bool DataINPipeDoubleBank; /** Indicates if the CDC interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe */
bool DataOUTPipeDoubleBank; /** Indicates if the CDC interface's OUT data pipe should use double banking */
uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */ uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used */
bool NotificationPipeDoubleBank; /** Indicates if the CDC interface's notification pipe should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -139,7 +144,7 @@
* \return A value from the \ref CDCHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref CDCHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding /** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding
* values of the interface have been changed to push the new settings to the USB device. * values of the interface have been changed to push the new settings to the USB device.

@ -35,7 +35,7 @@
#include "HID.h" #include "HID.h"
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* ConfigDescriptorData) void* ConfigDescriptorData)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;
@ -84,7 +84,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{ {
Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); EndpointData->EndpointAddress, EndpointData->EndpointSize,
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
HIDInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize; HIDInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= HID_FOUND_DATAPIPE_IN; FoundEndpoints |= HID_FOUND_DATAPIPE_IN;
@ -92,7 +93,8 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
else else
{ {
Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(HIDInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); EndpointData->EndpointAddress, EndpointData->EndpointSize,
HIDInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
HIDInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize; HIDInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true; HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;

@ -70,7 +70,10 @@
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the HID interface's IN data pipe */
bool DataINPipeDoubleBank; /** Indicates if the HID interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the HID interface's OUT data pipe */
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 uint8_t HIDInterfaceProtocol; /**< HID interface protocol value to match against if a specific
* boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL, * boot subclass protocol is required, either \ref HID_BOOT_MOUSE_PROTOCOL,
@ -151,7 +154,7 @@
* \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref HIDHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe. /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.

@ -35,7 +35,7 @@
#include "MIDI.h" #include "MIDI.h"
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* ConfigDescriptorData) void* ConfigDescriptorData)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;
@ -63,7 +63,8 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN) if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{ {
Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); EndpointData->EndpointAddress, EndpointData->EndpointSize,
MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MIDIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize; MIDIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= MIDI_FOUND_DATAPIPE_IN; FoundEndpoints |= MIDI_FOUND_DATAPIPE_IN;
@ -71,7 +72,8 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
else else
{ {
Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE); EndpointData->EndpointAddress, EndpointData->EndpointSize,
MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MIDIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize; MIDIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= MIDI_FOUND_DATAPIPE_OUT; FoundEndpoints |= MIDI_FOUND_DATAPIPE_OUT;

@ -64,7 +64,10 @@
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe */
bool DataINPipeDoubleBank; /** Indicates if the MIDI interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe */
bool DataOUTPipeDoubleBank; /** Indicates if the MIDI interface's OUT data pipe should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -114,7 +117,7 @@
* \return A value from the \ref MIDIHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref MIDIHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded. /** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded.
* *

@ -35,7 +35,7 @@
#include "MassStorage.h" #include "MassStorage.h"
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) void* DeviceConfigDescriptor)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;
@ -66,7 +66,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u
{ {
Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MSInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize; MSInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= MS_FOUND_DATAPIPE_IN; FoundEndpoints |= MS_FOUND_DATAPIPE_IN;
@ -75,7 +75,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, u
{ {
Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(MSInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
MSInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize; MSInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= MS_FOUND_DATAPIPE_OUT; FoundEndpoints |= MS_FOUND_DATAPIPE_OUT;

@ -67,8 +67,11 @@
{ {
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the MS interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Mass Storage interface's IN data pipe */
uint8_t DataOUTPipeNumber; /**< Pipe number of the MS interface's OUT data pipe */ bool DataINPipeDoubleBank; /** Indicates if the Mass Storage interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Mass Storage interface's OUT data pipe */
bool DataOUTPipeDoubleBank; /** Indicates if the Mass Storage interface's OUT data pipe should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -80,8 +83,8 @@
*/ */
uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device */ uint8_t InterfaceNumber; /**< Interface index of the Mass Storage interface within the attached device */
uint16_t DataINPipeSize; /**< Size in bytes of the MS interface's IN data pipe */ uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe */
uint16_t DataOUTPipeSize; /**< Size in bytes of the MS interface's OUT data pipe */ uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe */
uint32_t TransactionTag; /**< Current transaction tag for data synchronising of packets */ uint32_t TransactionTag; /**< Current transaction tag for data synchronising of packets */
} State; /**< State data for the USB class interface within the device. All elements in this section } State; /**< State data for the USB class interface within the device. All elements in this section
@ -194,7 +197,7 @@
* \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref MSHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface /** Sends a MASS STORAGE RESET control request to the attached device, resetting the Mass Storage Interface
* and readying it for the next Mass Storage command. * and readying it for the next Mass Storage command.

@ -35,7 +35,7 @@
#include "Printer.h" #include "Printer.h"
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) void* DeviceConfigDescriptor)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;
@ -69,7 +69,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
{ {
Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
PRNTInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize; PRNTInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= PRNT_FOUND_DATAPIPE_IN; FoundEndpoints |= PRNT_FOUND_DATAPIPE_IN;
@ -78,7 +78,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
{ {
Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
PRNTInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize; PRNTInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= PRNT_FOUND_DATAPIPE_OUT; FoundEndpoints |= PRNT_FOUND_DATAPIPE_OUT;

@ -66,7 +66,10 @@
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Printer interface's IN data pipe */
bool DataINPipeDoubleBank; /** Indicates if the Printer interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the Printer interface's OUT data pipe */
bool DataOUTPipeDoubleBank; /** Indicates if the Printer interface's OUT data pipe should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -119,7 +122,7 @@
* \return A value from the \ref PRNTHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref PRNTHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called /** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called
* once the connected device's configuration has been set, to ensure the printer is ready to accept commands. * once the connected device's configuration has been set, to ensure the printer is ready to accept commands.

@ -35,7 +35,7 @@
#include "StillImage.h" #include "StillImage.h"
uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) void* DeviceConfigDescriptor)
{ {
uint8_t FoundEndpoints = 0; uint8_t FoundEndpoints = 0;
@ -66,7 +66,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
{ {
Pipe_ConfigurePipe(SIInterfaceInfo->Config.EventsPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN, Pipe_ConfigurePipe(SIInterfaceInfo->Config.EventsPipeNumber, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); SIInterfaceInfo->Config.EventsPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
SIInterfaceInfo->State.EventsPipeSize = EndpointData->EndpointSize; SIInterfaceInfo->State.EventsPipeSize = EndpointData->EndpointSize;
Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS); Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS);
@ -80,7 +80,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
{ {
Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN, Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); SIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
SIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize; SIInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= SI_FOUND_DATAPIPE_IN; FoundEndpoints |= SI_FOUND_DATAPIPE_IN;
@ -89,7 +89,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, u
{ {
Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT, Pipe_ConfigurePipe(SIInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_DOUBLE); SIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
SIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize; SIInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= SI_FOUND_DATAPIPE_OUT; FoundEndpoints |= SI_FOUND_DATAPIPE_OUT;

@ -64,8 +64,13 @@
const struct const struct
{ {
uint8_t DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe */ uint8_t DataINPipeNumber; /**< Pipe number of the Still Image interface's IN data pipe */
bool DataINPipeDoubleBank; /** Indicates if the Still Image interface's IN data pipe should use double banking */
uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe */ uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe */
bool DataOUTPipeDoubleBank; /** Indicates if the Still Image interface's OUT data pipe should use double banking */
uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used */ uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used */
bool EventsPipeDoubleBank; /** Indicates if the Still Image interface's events data pipe should use double banking */
} Config; /**< Config data for the USB class interface within the device. All elements in this section } Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly. * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/ */
@ -125,7 +130,7 @@
* \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum * \return A value from the \ref SIHost_EnumerationFailure_ErrorCodes_t enum
*/ */
uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize, uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint16_t ConfigDescriptorSize,
uint8_t* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3); void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1, 3);
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands /** 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. * are issued to the device. Only one session can be open at the one time.

@ -69,7 +69,7 @@ uint8_t USB_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const Conf
#endif #endif
void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type) const uint8_t Type)
{ {
while (*BytesRem) while (*BytesRem)
@ -82,7 +82,7 @@ void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
} }
void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type, const uint8_t Type,
const uint8_t BeforeType) const uint8_t BeforeType)
{ {
@ -103,7 +103,7 @@ void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
} }
void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type, const uint8_t Type,
const uint8_t AfterType) const uint8_t AfterType)
{ {
@ -113,7 +113,7 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type); USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);
} }
uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine) uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, void** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine)
{ {
uint8_t ErrorCode; uint8_t ErrorCode;

@ -152,7 +152,7 @@
* } * }
* \endcode * \endcode
*/ */
uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, uint8_t** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine); uint8_t USB_GetNextDescriptorComp(uint16_t* BytesRem, void** CurrConfigLoc, ConfigComparatorPtr_t ComparatorRoutine);
/* Enums: */ /* Enums: */
/** Enum for the possible return codes of the \ref USB_GetDeviceConfigDescriptor() function. */ /** Enum for the possible return codes of the \ref USB_GetDeviceConfigDescriptor() function. */
@ -213,7 +213,7 @@
* \param[in] Type Descriptor type value to search for * \param[in] Type Descriptor type value to search for
*/ */
void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type) const uint8_t Type)
ATTR_NON_NULL_PTR_ARG(1, 2); ATTR_NON_NULL_PTR_ARG(1, 2);
@ -228,7 +228,7 @@
* \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor * \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor
*/ */
void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type, const uint8_t Type,
const uint8_t BeforeType) const uint8_t BeforeType)
ATTR_NON_NULL_PTR_ARG(1, 2); ATTR_NON_NULL_PTR_ARG(1, 2);
@ -243,7 +243,7 @@
* \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor * \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor
*/ */
void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc, void** const CurrConfigLoc,
const uint8_t Type, const uint8_t Type,
const uint8_t AfterType) const uint8_t AfterType)
ATTR_NON_NULL_PTR_ARG(1, 2); ATTR_NON_NULL_PTR_ARG(1, 2);
@ -256,10 +256,10 @@
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor
*/ */
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc) void** const CurrConfigLoc)
ATTR_NON_NULL_PTR_ARG(1, 2); ATTR_NON_NULL_PTR_ARG(1, 2);
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
uint8_t** const CurrConfigLoc) void** const CurrConfigLoc)
{ {
uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size; uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;

@ -228,7 +228,7 @@ static void USB_Device_GetInternalSerialDescriptor(void)
SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor); SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);
SignatureDescriptor.Header.Type = DTYPE_String; SignatureDescriptor.Header.Type = DTYPE_String;
uint8_t SigReadAddress = 0x0E; uint8_t SigReadAddress = 0x0E;
for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++) for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)
{ {
@ -314,7 +314,7 @@ static void USB_Device_GetStatus(void)
break; break;
#if !defined(CONTROL_ONLY_DEVICE) #if !defined(CONTROL_ONLY_DEVICE)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex); Endpoint_SelectEndpoint(USB_ControlRequest.wIndex & 0xFF);
CurrentStatus = Endpoint_IsStalled(); CurrentStatus = Endpoint_IsStalled();

Loading…
Cancel
Save