Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

To request to license the code under the MLA license (www.microchip.com/mla_license),
To request to license the code under the MLA license (www.microchip.com/mla_license),
please contact mla_licensing@microchip.com
*******************************************************************************/
//DOM-IGNORE-END
Expand Down Expand Up @@ -57,7 +57,7 @@ please contact mla_licensing@microchip.com

#include "usb_hal.h" // Hardware Abstraction Layer interface

/* USB Library version number. This can be used to verify in an application
/* USB Library version number. This can be used to verify in an application
specific version of the library is being used.
*/
#define USB_MAJOR_VER 2 // Firmware version, major release number.
Expand Down
6 changes: 3 additions & 3 deletions inc/usb_ch9.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

To request to license the code under the MLA license (www.microchip.com/mla_license),
To request to license the code under the MLA license (www.microchip.com/mla_license),
please contact mla_licensing@microchip.com
*******************************************************************************/
//DOM-IGNORE-END
Expand Down Expand Up @@ -179,7 +179,7 @@ typedef struct __attribute__ ((packed)) _USB_ENDPOINT_DESCRIPTOR
#define EP_SM_PKT_BULK_FS 8 // Small full-speed bulk packet

/* Descriptor IDs
The descriptor ID type defines the information required by the HOST during a
The descriptor ID type defines the information required by the HOST during a
GET_DESCRIPTOR request
*/
typedef struct
Expand Down Expand Up @@ -521,7 +521,7 @@ typedef union __attribute__ ((packed))
/********************************************************************
USB Endpoint Definitions
USB Standard EP Address Format: DIR:X:X:X:EP3:EP2:EP1:EP0
This is used in the descriptors.
This is used in the descriptors.
********************************************************************/
#define _EP_IN 0x80
#define _EP_OUT 0x00
Expand Down
124 changes: 62 additions & 62 deletions inc/usb_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

To request to license the code under the MLA license (www.microchip.com/mla_license),
To request to license the code under the MLA license (www.microchip.com/mla_license),
please contact mla_licensing@microchip.com
*******************************************************************************/
//DOM-IGNORE-END
Expand Down Expand Up @@ -213,110 +213,110 @@ typedef enum
EVENT_HOST_STACK_BASE = 100,

// A USB hub has been attached. Hub support is not currently available.
EVENT_HUB_ATTACH,
EVENT_HUB_ATTACH,

// A stall has occurred. This event is not used by the Host stack.
EVENT_STALL,
EVENT_STALL,

// VBus SRP Pulse, (VBus > 2.0v), Data: uint8_t Port Number (For future support)
EVENT_VBUS_SES_REQUEST,
// The voltage on Vbus has dropped below 4.4V/4.7V. The application is
EVENT_VBUS_SES_REQUEST,

// The voltage on Vbus has dropped below 4.4V/4.7V. The application is
// responsible for monitoring Vbus and calling USBHostVbusEvent() with this
// event. This event is not generated by the stack.
EVENT_VBUS_OVERCURRENT,
EVENT_VBUS_OVERCURRENT,

// An enumerating device is requesting power. The data associated with this
// event is of the data type USB_VBUS_POWER_EVENT_DATA. Note that
// event is of the data type USB_VBUS_POWER_EVENT_DATA. Note that
// the requested current is specified in 2mA units, identical to the power
// specification in a device's Configuration Descriptor.
EVENT_VBUS_REQUEST_POWER,
EVENT_VBUS_REQUEST_POWER,

// Release power from a detaching device. The data associated with this
// event is of the data type USB_VBUS_POWER_EVENT_DATA. The current value
// specified in the data can be ignored.
EVENT_VBUS_RELEASE_POWER,
// The voltage on Vbus is good, and the USB OTG module can be powered on.
// The application is responsible for monitoring Vbus and calling
// USBHostVbusEvent() with this event. This event is not generated by the
EVENT_VBUS_RELEASE_POWER,

// The voltage on Vbus is good, and the USB OTG module can be powered on.
// The application is responsible for monitoring Vbus and calling
// USBHostVbusEvent() with this event. This event is not generated by the
// stack. If the application issues an EVENT_VBUS_OVERCURRENT, then no
// power will be applied to that port, and no device can attach to that
// port, until the application issues the EVENT_VBUS_POWER_AVAILABLE for
// the port.
EVENT_VBUS_POWER_AVAILABLE,
EVENT_VBUS_POWER_AVAILABLE,

// The attached device is not supported by the application. The attached
// device is not allowed to enumerate.
EVENT_UNSUPPORTED_DEVICE,
EVENT_UNSUPPORTED_DEVICE,

// Cannot enumerate the attached device. This is generated if communication
// errors prevent the device from enumerating.
EVENT_CANNOT_ENUMERATE,
// The client driver cannot initialize the the attached device. The
EVENT_CANNOT_ENUMERATE,

// The client driver cannot initialize the the attached device. The
// attached is not allowed to enumerate.
EVENT_CLIENT_INIT_ERROR,
EVENT_CLIENT_INIT_ERROR,

// The Host stack does not have enough heap space to enumerate the device.
// Check the amount of heap space allocated to the application. In MPLAB,
// select Project> Build Options...> Project. Select the appropriate
// linker tab, and inspect the "Heap size" entry.
EVENT_OUT_OF_MEMORY,
EVENT_OUT_OF_MEMORY,

// Unspecified host error. (This error should not occur).
EVENT_UNSPECIFIED_ERROR,
EVENT_UNSPECIFIED_ERROR,

// USB cable has been detached. The data associated with this event is the
// address of detached device, a single uint8_t.
EVENT_DETACH,
EVENT_DETACH,

// A USB transfer has completed. The data associated with this event is of
// the data type HOST_TRANSFER_DATA if the event is generated from the host
// stack.
EVENT_TRANSFER,

// A USB Start of Frame token has been received. This event is not
// used by the Host stack.
EVENT_SOF,
EVENT_SOF,

// Device-mode resume received. This event is not used by the Host stack.
EVENT_RESUME,

// Device-mode suspend/idle event received. This event is not used by the
// Host stack.
EVENT_SUSPEND,
// Device-mode bus reset received. This event is not used by the Host
// stack.
EVENT_RESET,

// Device-mode bus reset received. This event is not used by the Host
// stack.
EVENT_RESET,

// In Host mode, an isochronous data read has completed. This event will only
// be passed to the DataEventHandler, which is only utilized if it is defined.
// Note that the DataEventHandler is called from within the USB interrupt, so
// Note that the DataEventHandler is called from within the USB interrupt, so
// it is critical that it return in time for the next isochronous data packet.
EVENT_DATA_ISOC_READ,

// In Host mode, an isochronous data write has completed. This event will only
// be passed to the DataEventHandler, which is only utilized if it is defined.
// Note that the DataEventHandler is called from within the USB interrupt, so
// be passed to the DataEventHandler, which is only utilized if it is defined.
// Note that the DataEventHandler is called from within the USB interrupt, so
// it is critical that it return in time for the next isochronous data packet.
EVENT_DATA_ISOC_WRITE,

// In Host mode, this event gives the application layer the option to reject
// a client driver that was selected by the stack. This is needed when multiple
// devices are supported by class level support, but one configuration and client
// devices are supported by class level support, but one configuration and client
// driver is preferred over another. Since configuration number is not guaranteed,
// the stack cannot do this automatically. This event is issued only when
// looking through configuration descriptors; the driver selected at the device
// level cannot be overridden, since there shouldn't be any other options to
// the stack cannot do this automatically. This event is issued only when
// looking through configuration descriptors; the driver selected at the device
// level cannot be overridden, since there shouldn't be any other options to
// choose from.
EVENT_OVERRIDE_CLIENT_DRIVER_SELECTION,

// In host mode, this event is thrown for every millisecond that passes. Like all
// events, this is thrown from the USBHostTasks() or USBTasks() routine so its
// timeliness will be determined by the rate that these functions are called. If
// they are not called very often, then the 1ms events will build up and be
// they are not called very often, then the 1ms events will build up and be
// dispatched as the USBTasks() or USBHostTasks() functions are called (one event
// per call to these functions.
EVENT_1MS,
Expand All @@ -327,7 +327,7 @@ typedef enum
// up/down audio hardware.
EVENT_ALT_INTERFACE,

// If the application layer must do things to the device before the device is
// If the application layer must do things to the device before the device is
// configured, they should be done at this point. The application layer should
// return true to hold the USB state machine at this point, while any USB or other
// processing continues. When the USB state machine can safely proceed, the application
Expand All @@ -342,19 +342,19 @@ typedef enum
EVENT_HID_BASE = 600, // Offset for Human Interface Device class events

EVENT_PRINTER_BASE = 700, // Offset for Printer class events

EVENT_CDC_BASE = 800, // Offset for CDC class events

EVENT_CHARGER_BASE = 900, // Offset for Charger client driver events.

EVENT_AUDIO_BASE = 1000, // Offset for Audio client driver events.

EVENT_USER_BASE = 10000, // Add integral values to this event number
// to create user-defined events.

// There was a transfer error on the USB. The data associated with this
// event is of data type HOST_TRANSFER_DATA.
EVENT_BUS_ERROR = INT_MAX
EVENT_BUS_ERROR = INT_MAX

} USB_EVENT;

Expand Down Expand Up @@ -399,7 +399,7 @@ This data structure is passed to the application layer when a client driver is
select, in case multiple client drivers can support a particular device.
*/
typedef struct _override_client_driver_data
{
{
uint16_t idVendor;
uint16_t idProduct;
uint8_t bDeviceClass;
Expand Down Expand Up @@ -438,26 +438,26 @@ stalled (ie. bit 0 = EP0, bit 1 = EP1, etc.)
identified by the "event" parameter and may have associated
data. If the higher layer was able to handle the event, it
should return true. If not, it should return false.

Preconditions:
USBInitialize must have been called to initialize the USB SW
Stack.

Parameters:
USB_EVENT event - Identifies the bus event that occurred
void *data - Pointer to event-specific data
unsigned int size - Size of the event-specific data

Return Values:
None

Remarks:
The function is name is defined by the layer that implements
it. A pointer to the function will be placed by into a table
that the lower-layer will use to call it. This requires the
function to use a specific call "signature" (return data type
and values and data parameter types and values).

*******************************************************************************/

typedef bool (*USB_EVENT_HANDLER) ( USB_EVENT event, void *data, unsigned int size );
Expand Down
Loading