diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd.h deleted file mode 100644 index b9d0adb40..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd.h +++ /dev/null @@ -1,711 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd.h 575 2012-11-20 01:35:56Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ - -#ifndef __USBD_H__ -#define __USBD_H__ - -/** \file - * \brief Common definitions and declarations for the USB stack. - * - * Common definitions and declarations for the USB stack. - * \addtogroup USBD_Core - * @{ - */ - -#include "lpc_types.h" - -#if defined(__GNUC__) -/* As per http://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax, -6.29 Attributes Syntax -"An attribute specifier list may appear as part of a struct, union or -enum specifier. It may go either immediately after the struct, union -or enum keyword, or after the closing brace. The former syntax is -preferred. Where attribute specifiers follow the closing brace, they -are considered to relate to the structure, union or enumerated type -defined, not to any enclosing declaration the type specifier appears -in, and the type defined is not complete until after the attribute -specifiers." -So use POST_PACK immediately after struct keyword -*/ -#define PRE_PACK -#define POST_PACK __attribute__((__packed__)) -#define ALIGNED(n) __attribute__((aligned (n))) - -#elif defined(__arm) -#define PRE_PACK __packed -#define POST_PACK -#define ALIGNED(n) __align(n) - -#elif defined(__ICCARM__) -#define PRE_PACK __packed -#define POST_PACK -#define PRAGMA_ALIGN_4096 _Pragma("data_alignment=4096") -#define PRAGMA_ALIGN_2048 _Pragma("data_alignment=2048") -#define PRAGMA_ALIGN_512 _Pragma("data_alignment=512") -#define PRAGMA_ALIGN_256 _Pragma("data_alignment=256") -#define PRAGMA_ALIGN_128 _Pragma("data_alignment=128") -#define PRAGMA_ALIGN_64 _Pragma("data_alignment=64") -#define PRAGMA_ALIGN_48 _Pragma("data_alignment=48") -#define PRAGMA_ALIGN_32 _Pragma("data_alignment=32") -#define PRAGMA_ALIGN_4 _Pragma("data_alignment=4") -#define ALIGNED(n) PRAGMA_ALIGN_##n - -#pragma diag_suppress=Pe021 -#endif - -/** Structure to pack lower and upper byte to form 16 bit word. */ -PRE_PACK struct POST_PACK _WB_T -{ - uint8_t L; /**< lower byte */ - uint8_t H; /**< upper byte */ -}; -/** Structure to pack lower and upper byte to form 16 bit word.*/ -typedef struct _WB_T WB_T; - -/** Union of \ref _WB_T struct and 16 bit word.*/ -PRE_PACK union POST_PACK __WORD_BYTE -{ - uint16_t W; /**< data member to do 16 bit access */ - WB_T WB; /**< data member to do 8 bit access */ -} ; -/** Union of \ref _WB_T struct and 16 bit word.*/ -typedef union __WORD_BYTE WORD_BYTE; - -/** bmRequestType.Dir defines - * @{ - */ -/** Request from host to device */ -#define REQUEST_HOST_TO_DEVICE 0 -/** Request from device to host */ -#define REQUEST_DEVICE_TO_HOST 1 -/** @} */ - -/** bmRequestType.Type defines - * @{ - */ -/** Standard Request */ -#define REQUEST_STANDARD 0 -/** Class Request */ -#define REQUEST_CLASS 1 -/** Vendor Request */ -#define REQUEST_VENDOR 2 -/** Reserved Request */ -#define REQUEST_RESERVED 3 -/** @} */ - -/** bmRequestType.Recipient defines - * @{ - */ -/** Request to device */ -#define REQUEST_TO_DEVICE 0 -/** Request to interface */ -#define REQUEST_TO_INTERFACE 1 -/** Request to endpoint */ -#define REQUEST_TO_ENDPOINT 2 -/** Request to other */ -#define REQUEST_TO_OTHER 3 -/** @} */ - -/** Structure to define 8 bit USB request.*/ -PRE_PACK struct POST_PACK _BM_T -{ - uint8_t Recipient : 5; /**< Recipient type. */ - uint8_t Type : 2; /**< Request type. */ - uint8_t Dir : 1; /**< Direction type. */ -}; -/** Structure to define 8 bit USB request.*/ -typedef struct _BM_T BM_T; - -/** Union of \ref _BM_T struct and 8 bit byte.*/ -PRE_PACK union POST_PACK _REQUEST_TYPE -{ - uint8_t B; /**< byte wide access memeber */ - BM_T BM; /**< bitfield structure access memeber */ -} ; -/** Union of \ref _BM_T struct and 8 bit byte.*/ -typedef union _REQUEST_TYPE REQUEST_TYPE; - -/** USB Standard Request Codes - * @{ - */ -/** GET_STATUS request */ -#define USB_REQUEST_GET_STATUS 0 -/** CLEAR_FEATURE request */ -#define USB_REQUEST_CLEAR_FEATURE 1 -/** SET_FEATURE request */ -#define USB_REQUEST_SET_FEATURE 3 -/** SET_ADDRESS request */ -#define USB_REQUEST_SET_ADDRESS 5 -/** GET_DESCRIPTOR request */ -#define USB_REQUEST_GET_DESCRIPTOR 6 -/** SET_DESCRIPTOR request */ -#define USB_REQUEST_SET_DESCRIPTOR 7 -/** GET_CONFIGURATION request */ -#define USB_REQUEST_GET_CONFIGURATION 8 -/** SET_CONFIGURATION request */ -#define USB_REQUEST_SET_CONFIGURATION 9 -/** GET_INTERFACE request */ -#define USB_REQUEST_GET_INTERFACE 10 -/** SET_INTERFACE request */ -#define USB_REQUEST_SET_INTERFACE 11 -/** SYNC_FRAME request */ -#define USB_REQUEST_SYNC_FRAME 12 -/** @} */ - -/** USB GET_STATUS Bit Values - * @{ - */ -/** SELF_POWERED status*/ -#define USB_GETSTATUS_SELF_POWERED 0x01 -/** REMOTE_WAKEUP capable status*/ -#define USB_GETSTATUS_REMOTE_WAKEUP 0x02 -/** ENDPOINT_STALL status*/ -#define USB_GETSTATUS_ENDPOINT_STALL 0x01 -/** @} */ - -/** USB Standard Feature selectors - * @{ - */ -/** ENDPOINT_STALL feature*/ -#define USB_FEATURE_ENDPOINT_STALL 0 -/** REMOTE_WAKEUP feature*/ -#define USB_FEATURE_REMOTE_WAKEUP 1 -/** TEST_MODE feature*/ -#define USB_FEATURE_TEST_MODE 2 -/** @} */ - -/** USB Default Control Pipe Setup Packet*/ -PRE_PACK struct POST_PACK _USB_SETUP_PACKET -{ - REQUEST_TYPE bmRequestType; /**< This bitmapped field identifies the characteristics - of the specific request. \sa _BM_T. - */ - uint8_t bRequest; /**< This field specifies the particular request. The - Type bits in the bmRequestType field modify the meaning - of this field. \sa USBD_REQUEST. - */ - WORD_BYTE wValue; /**< Used to pass a parameter to the device, specific - to the request. - */ - WORD_BYTE wIndex; /**< Used to pass a parameter to the device, specific - to the request. The wIndex field is often used in - requests to specify an endpoint or an interface. - */ - uint16_t wLength; /**< This field specifies the length of the data - transferred during the second phase of the control - transfer. - */ -} ; -/** USB Default Control Pipe Setup Packet*/ -typedef struct _USB_SETUP_PACKET USB_SETUP_PACKET; - - -/** USB Descriptor Types - * @{ - */ -/** Device descriptor type */ -#define USB_DEVICE_DESCRIPTOR_TYPE 1 -/** Configuration descriptor type */ -#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 -/** String descriptor type */ -#define USB_STRING_DESCRIPTOR_TYPE 3 -/** Interface descriptor type */ -#define USB_INTERFACE_DESCRIPTOR_TYPE 4 -/** Endpoint descriptor type */ -#define USB_ENDPOINT_DESCRIPTOR_TYPE 5 -/** Device qualifier descriptor type */ -#define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE 6 -/** Other speed configuration descriptor type */ -#define USB_OTHER_SPEED_CONFIG_DESCRIPTOR_TYPE 7 -/** Interface power descriptor type */ -#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 8 -/** OTG descriptor type */ -#define USB_OTG_DESCRIPTOR_TYPE 9 -/** Debug descriptor type */ -#define USB_DEBUG_DESCRIPTOR_TYPE 10 -/** Interface association descriptor type */ -#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE 11 -/** @} */ - -/** USB Device Classes - * @{ - */ -/** Reserved device class */ -#define USB_DEVICE_CLASS_RESERVED 0x00 -/** Audio device class */ -#define USB_DEVICE_CLASS_AUDIO 0x01 -/** Communications device class */ -#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 -/** Human interface device class */ -#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 -/** monitor device class */ -#define USB_DEVICE_CLASS_MONITOR 0x04 -/** physical interface device class */ -#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 -/** power device class */ -#define USB_DEVICE_CLASS_POWER 0x06 -/** Printer device class */ -#define USB_DEVICE_CLASS_PRINTER 0x07 -/** Storage device class */ -#define USB_DEVICE_CLASS_STORAGE 0x08 -/** Hub device class */ -#define USB_DEVICE_CLASS_HUB 0x09 -/** miscellaneous device class */ -#define USB_DEVICE_CLASS_MISCELLANEOUS 0xEF -/** Application device class */ -#define USB_DEVICE_CLASS_APP 0xFE -/** Vendor specific device class */ -#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF -/** @} */ - -/** bmAttributes in Configuration Descriptor - * @{ - */ -/** Power field mask */ -#define USB_CONFIG_POWERED_MASK 0x40 -/** Bus powered */ -#define USB_CONFIG_BUS_POWERED 0x80 -/** Self powered */ -#define USB_CONFIG_SELF_POWERED 0xC0 -/** remote wakeup */ -#define USB_CONFIG_REMOTE_WAKEUP 0x20 -/** @} */ - -/** bMaxPower in Configuration Descriptor */ -#define USB_CONFIG_POWER_MA(mA) ((mA)/2) - -/** bEndpointAddress in Endpoint Descriptor - * @{ - */ -/** Endopint address mask */ -#define USB_ENDPOINT_DIRECTION_MASK 0x80 -/** Macro to convert OUT endopint number to endpoint address value. */ -#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) -/** Macro to convert IN endopint number to endpoint address value. */ -#define USB_ENDPOINT_IN(addr) ((addr) | 0x80) -/** @} */ - -/** bmAttributes in Endpoint Descriptor - * @{ - */ -/** Endopint type mask */ -#define USB_ENDPOINT_TYPE_MASK 0x03 -/** Control Endopint type */ -#define USB_ENDPOINT_TYPE_CONTROL 0x00 -/** isochronous Endopint type */ -#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 -/** bulk Endopint type */ -#define USB_ENDPOINT_TYPE_BULK 0x02 -/** interrupt Endopint type */ -#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 -/** Endopint sync type mask */ -#define USB_ENDPOINT_SYNC_MASK 0x0C -/** no synchronization Endopint */ -#define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION 0x00 -/** Asynchronous sync Endopint */ -#define USB_ENDPOINT_SYNC_ASYNCHRONOUS 0x04 -/** Adaptive sync Endopint */ -#define USB_ENDPOINT_SYNC_ADAPTIVE 0x08 -/** Synchronous sync Endopint */ -#define USB_ENDPOINT_SYNC_SYNCHRONOUS 0x0C -/** Endopint usage type mask */ -#define USB_ENDPOINT_USAGE_MASK 0x30 -/** Endopint data usage type */ -#define USB_ENDPOINT_USAGE_DATA 0x00 -/** Endopint feedback usage type */ -#define USB_ENDPOINT_USAGE_FEEDBACK 0x10 -/** Endopint implicit feedback usage type */ -#define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK 0x20 -/** Endopint reserved usage type */ -#define USB_ENDPOINT_USAGE_RESERVED 0x30 -/** @} */ - -/** Control endopint EP0's maximum packet size in high-speed mode.*/ -#define USB_ENDPOINT_0_HS_MAXP 64 -/** Control endopint EP0's maximum packet size in low-speed mode.*/ -#define USB_ENDPOINT_0_LS_MAXP 8 -/** Bulk endopint's maximum packet size in high-speed mode.*/ -#define USB_ENDPOINT_BULK_HS_MAXP 512 - -/** USB Standard Device Descriptor */ -PRE_PACK struct POST_PACK _USB_DEVICE_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes. */ - uint8_t bDescriptorType; /**< DEVICE Descriptor Type. */ - uint16_t bcdUSB; /**< BUSB Specification Release Number in - Binary-Coded Decimal (i.e., 2.10 is 210H). - This field identifies the release of the USB - Specification with which the device and its - descriptors are compliant. - */ - uint8_t bDeviceClass; /**< Class code (assigned by the USB-IF). - If this field is reset to zero, each interface - within a configuration specifies its own - class information and the various - interfaces operate independently.\n - If this field is set to a value between 1 and - FEH, the device supports different class - specifications on different interfaces and - the interfaces may not operate - independently. This value identifies the - class definition used for the aggregate - interfaces. \n - If this field is set to FFH, the device class - is vendor-specific. - */ - uint8_t bDeviceSubClass; /**< Subclass code (assigned by the USB-IF). - These codes are qualified by the value of - the bDeviceClass field. \n - If the bDeviceClass field is reset to zero, - this field must also be reset to zero. \n - If the bDeviceClass field is not set to FFH, - all values are reserved for assignment by - the USB-IF. - */ - uint8_t bDeviceProtocol; /**< Protocol code (assigned by the USB-IF). - These codes are qualified by the value of - the bDeviceClass and the - bDeviceSubClass fields. If a device - supports class-specific protocols on a - device basis as opposed to an interface - basis, this code identifies the protocols - that the device uses as defined by the - specification of the device class. \n - If this field is reset to zero, the device - does not use class-specific protocols on a - device basis. However, it may use classspecific - protocols on an interface basis. \n - If this field is set to FFH, the device uses a - vendor-specific protocol on a device basis. - */ - uint8_t bMaxPacketSize0; /**< Maximum packet size for endpoint zero - (only 8, 16, 32, or 64 are valid). For HS devices - is fixed to 64. - */ - - uint16_t idVendor; /**< Vendor ID (assigned by the USB-IF). */ - uint16_t idProduct; /**< Product ID (assigned by the manufacturer). */ - uint16_t bcdDevice; /**< Device release number in binary-coded decimal. */ - uint8_t iManufacturer; /**< Index of string descriptor describing manufacturer. */ - uint8_t iProduct; /**< Index of string descriptor describing product. */ - uint8_t iSerialNumber; /**< Index of string descriptor describing the device’s - serial number. - */ - uint8_t bNumConfigurations; /**< Number of possible configurations. */ -} ; -/** USB Standard Device Descriptor */ -typedef struct _USB_DEVICE_DESCRIPTOR USB_DEVICE_DESCRIPTOR; - -/** USB 2.0 Device Qualifier Descriptor */ -PRE_PACK struct POST_PACK _USB_DEVICE_QUALIFIER_DESCRIPTOR -{ - uint8_t bLength; /**< Size of descriptor */ - uint8_t bDescriptorType; /**< Device Qualifier Type */ - uint16_t bcdUSB; /**< USB specification version number (e.g., 0200H for V2.00) */ - uint8_t bDeviceClass; /**< Class Code */ - uint8_t bDeviceSubClass; /**< SubClass Code */ - uint8_t bDeviceProtocol; /**< Protocol Code */ - uint8_t bMaxPacketSize0; /**< Maximum packet size for other speed */ - uint8_t bNumConfigurations; /**< Number of Other-speed Configurations */ - uint8_t bReserved; /**< Reserved for future use, must be zero */ -} ; -/** USB 2.0 Device Qualifier Descriptor */ -typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR USB_DEVICE_QUALIFIER_DESCRIPTOR; - -/** USB Standard Configuration Descriptor */ -PRE_PACK struct POST_PACK _USB_CONFIGURATION_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes */ - uint8_t bDescriptorType; /**< CONFIGURATION Descriptor Type*/ - uint16_t wTotalLength; /**< Total length of data returned for this - configuration. Includes the combined length - of all descriptors (configuration, interface, - endpoint, and class- or vendor-specific) - returned for this configuration.*/ - uint8_t bNumInterfaces; /**< Number of interfaces supported by this configuration*/ - uint8_t bConfigurationValue; /**< Value to use as an argument to the - SetConfiguration() request to select this - configuration. */ - uint8_t iConfiguration; /**< Index of string descriptor describing this - configuration*/ - uint8_t bmAttributes; /**< Configuration characteristics \n - D7: Reserved (set to one)\n - D6: Self-powered \n - D5: Remote Wakeup \n - D4...0: Reserved (reset to zero) \n - D7 is reserved and must be set to one for - historical reasons. \n - A device configuration that uses power from - the bus and a local source reports a non-zero - value in bMaxPower to indicate the amount of - bus power required and sets D6. The actual - power source at runtime may be determined - using the GetStatus(DEVICE) request (see - USB 2.0 spec Section 9.4.5). \n - If a device configuration supports remote - wakeup, D5 is set to one.*/ - uint8_t bMaxPower; /**< Maximum power consumption of the USB - device from the bus in this specific - configuration when the device is fully - operational. Expressed in 2 mA units - (i.e., 50 = 100 mA). \n - Note: A device configuration reports whether - the configuration is bus-powered or selfpowered. - Device status reports whether the - device is currently self-powered. If a device is - disconnected from its external power source, it - updates device status to indicate that it is no - longer self-powered. \n - A device may not increase its power draw - from the bus, when it loses its external power - source, beyond the amount reported by its - configuration. \n - If a device can continue to operate when - disconnected from its external power source, it - continues to do so. If the device cannot - continue to operate, it fails operations it can - no longer support. The USB System Software - may determine the cause of the failure by - checking the status and noting the loss of the - device’s power source.*/ -} ; -/** USB Standard Configuration Descriptor */ -typedef struct _USB_CONFIGURATION_DESCRIPTOR USB_CONFIGURATION_DESCRIPTOR; - -/** USB Standard Interface Association Descriptor */ -PRE_PACK struct POST_PACK _USB_IAD_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes*/ - uint8_t bDescriptorType; /**< INTERFACE ASSOCIATION Descriptor Type*/ - uint8_t bFirstInterface; /**< Interface number of the first interface that is - associated with this function.*/ - uint8_t bInterfaceCount; /**< Number of contiguous interfaces that are - associated with this function. */ - uint8_t bFunctionClass; /**< Class code (assigned by USB-IF). \n - A value of zero is not allowed in this descriptor. - If this field is FFH, the function class is vendorspecific. - All other values are reserved for assignment by - the USB-IF.*/ - uint8_t bFunctionSubClass; /**< Subclass code (assigned by USB-IF). \n - If the bFunctionClass field is not set to FFH all - values are reserved for assignment by the USBIF.*/ - uint8_t bFunctionProtocol; /**< Protocol code (assigned by the USB). \n - These codes are qualified by the values of the - bFunctionClass and bFunctionSubClass fields.*/ - uint8_t iFunction; /**< Index of string descriptor describing this function.*/ -} ; -/** USB Standard Interface Association Descriptor */ -typedef struct _USB_IAD_DESCRIPTOR USB_IAD_DESCRIPTOR; - -/** USB Standard Interface Descriptor */ -PRE_PACK struct POST_PACK _USB_INTERFACE_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes*/ - uint8_t bDescriptorType; /**< INTERFACE Descriptor Type*/ - uint8_t bInterfaceNumber; /**< Number of this interface. Zero-based - value identifying the index in the array of - concurrent interfaces supported by this - configuration.*/ - uint8_t bAlternateSetting; /**< Value used to select this alternate setting - for the interface identified in the prior field*/ - uint8_t bNumEndpoints; /**< Number of endpoints used by this - interface (excluding endpoint zero). If this - value is zero, this interface only uses the - Default Control Pipe.*/ - uint8_t bInterfaceClass; /**< Class code (assigned by the USB-IF). \n - A value of zero is reserved for future - standardization. \n - If this field is set to FFH, the interface - class is vendor-specific. \n - All other values are reserved for - assignment by the USB-IF.*/ - uint8_t bInterfaceSubClass; /**< Subclass code (assigned by the USB-IF). \n - These codes are qualified by the value of - the bInterfaceClass field. \n - If the bInterfaceClass field is reset to zero, - this field must also be reset to zero. \n - If the bInterfaceClass field is not set to - FFH, all values are reserved for - assignment by the USB-IF.*/ - uint8_t bInterfaceProtocol; /**< Protocol code (assigned by the USB). \n - These codes are qualified by the value of - the bInterfaceClass and the - bInterfaceSubClass fields. If an interface - supports class-specific requests, this code - identifies the protocols that the device - uses as defined by the specification of the - device class. \n - If this field is reset to zero, the device - does not use a class-specific protocol on - this interface. \n - If this field is set to FFH, the device uses - a vendor-specific protocol for this - interface.*/ - uint8_t iInterface; /**< Index of string descriptor describing this interface*/ -} ; -/** USB Standard Interface Descriptor */ -typedef struct _USB_INTERFACE_DESCRIPTOR USB_INTERFACE_DESCRIPTOR; - -/** USB Standard Endpoint Descriptor */ -PRE_PACK struct POST_PACK _USB_ENDPOINT_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes*/ - uint8_t bDescriptorType; /**< ENDPOINT Descriptor Type*/ - uint8_t bEndpointAddress; /**< The address of the endpoint on the USB device - described by this descriptor. The address is - encoded as follows: \n - Bit 3...0: The endpoint number \n - Bit 6...4: Reserved, reset to zero \n - Bit 7: Direction, ignored for control endpoints - 0 = OUT endpoint - 1 = IN endpoint. \n \sa USBD_ENDPOINT_ADR_Type*/ - uint8_t bmAttributes; /**< This field describes the endpoint’s attributes when it is - configured using the bConfigurationValue. \n - Bits 1..0: Transfer Type - \li 00 = Control - \li 01 = Isochronous - \li 10 = Bulk - \li 11 = Interrupt \n - If not an isochronous endpoint, bits 5..2 are reserved - and must be set to zero. If isochronous, they are - defined as follows: \n - Bits 3..2: Synchronization Type - \li 00 = No Synchronization - \li 01 = Asynchronous - \li 10 = Adaptive - \li 11 = Synchronous \n - Bits 5..4: Usage Type - \li 00 = Data endpoint - \li 01 = Feedback endpoint - \li 10 = Implicit feedback Data endpoint - \li 11 = Reserved \n - Refer to Chapter 5 of USB 2.0 specification for more information. \n - All other bits are reserved and must be reset to zero. - Reserved bits must be ignored by the host. - \n \sa USBD_EP_ATTR_Type*/ - uint16_t wMaxPacketSize; /**< Maximum packet size this endpoint is capable of - sending or receiving when this configuration is - selected. \n - For isochronous endpoints, this value is used to - reserve the bus time in the schedule, required for the - per-(micro)frame data payloads. The pipe may, on an - ongoing basis, actually use less bandwidth than that - reserved. The device reports, if necessary, the actual - bandwidth used via its normal, non-USB defined - mechanisms. \n - For all endpoints, bits 10..0 specify the maximum - packet size (in bytes). \n - For high-speed isochronous and interrupt endpoints: \n - Bits 12..11 specify the number of additional transaction - opportunities per microframe: \n - \li 00 = None (1 transaction per microframe) - \li 01 = 1 additional (2 per microframe) - \li 10 = 2 additional (3 per microframe) - \li 11 = Reserved \n - Bits 15..13 are reserved and must be set to zero.*/ - uint8_t bInterval; /**< Interval for polling endpoint for data transfers. - Expressed in frames or microframes depending on the - device operating speed (i.e., either 1 millisecond or - 125 µs units). - \li For full-/high-speed isochronous endpoints, this value - must be in the range from 1 to 16. The bInterval value - is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a - bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$). - \li For full-/low-speed interrupt endpoints, the value of - this field may be from 1 to 255. - \li For high-speed interrupt endpoints, the bInterval value - is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a - bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$) . This value - must be from 1 to 16. - \li For high-speed bulk/control OUT endpoints, the - bInterval must specify the maximum NAK rate of the - endpoint. A value of 0 indicates the endpoint never - NAKs. Other values indicate at most 1 NAK each - bInterval number of microframes. This value must be - in the range from 0 to 255. \n - Refer to Chapter 5 of USB 2.0 specification for more information. - */ -} ; -/** USB Standard Endpoint Descriptor */ -typedef struct _USB_ENDPOINT_DESCRIPTOR USB_ENDPOINT_DESCRIPTOR; - -/** USB String Descriptor */ -PRE_PACK struct POST_PACK _USB_STRING_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes*/ - uint8_t bDescriptorType; /**< STRING Descriptor Type*/ - uint16_t bString/*[]*/; /**< UNICODE encoded string */ -} ; -/** USB String Descriptor */ -typedef struct _USB_STRING_DESCRIPTOR USB_STRING_DESCRIPTOR; - -/** USB Common Descriptor */ -PRE_PACK struct POST_PACK _USB_COMMON_DESCRIPTOR -{ - uint8_t bLength; /**< Size of this descriptor in bytes*/ - uint8_t bDescriptorType; /**< Descriptor Type*/ -} ; -/** USB Common Descriptor */ -typedef struct _USB_COMMON_DESCRIPTOR USB_COMMON_DESCRIPTOR; - -/** USB Other Speed Configuration */ -PRE_PACK struct POST_PACK _USB_OTHER_SPEED_CONFIGURATION -{ - uint8_t bLength; /**< Size of descriptor*/ - uint8_t bDescriptorType; /**< Other_speed_Configuration Type*/ - uint16_t wTotalLength; /**< Total length of data returned*/ - uint8_t bNumInterfaces; /**< Number of interfaces supported by this speed configuration*/ - uint8_t bConfigurationValue; /**< Value to use to select configuration*/ - uint8_t IConfiguration; /**< Index of string descriptor*/ - uint8_t bmAttributes; /**< Same as Configuration descriptor*/ - uint8_t bMaxPower; /**< Same as Configuration descriptor*/ -} ; -/** USB Other Speed Configuration */ -typedef struct _USB_OTHER_SPEED_CONFIGURATION USB_OTHER_SPEED_CONFIGURATION; - -/** \ingroup USBD_Core - * USB device stack/module handle. - */ -typedef void* USBD_HANDLE_T; - -#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) -#define B3VAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF) - -#define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR)) -#define USB_CONFIGURATION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR)) -#define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR)) -#define USB_INTERFACE_ASSOC_DESC_SIZE (sizeof(USB_IAD_DESCRIPTOR)) -#define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR)) -#define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)) -#define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION)) - -/** @}*/ - -#endif /* __USBD_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_adc.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_adc.h deleted file mode 100644 index dcbdac3a9..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_adc.h +++ /dev/null @@ -1,383 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_audio.h 165 2011-04-14 17:41:11Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Audio Device Class Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __AUDIO_H__ -#define __AUDIO_H__ - - -/* Audio Interface Subclass Codes */ -#define AUDIO_SUBCLASS_UNDEFINED 0x00 -#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01 -#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02 -#define AUDIO_SUBCLASS_MIDISTREAMING 0x03 - -/* Audio Interface Protocol Codes */ -#define AUDIO_PROTOCOL_UNDEFINED 0x00 - - -/* Audio Descriptor Types */ -#define AUDIO_UNDEFINED_DESCRIPTOR_TYPE 0x20 -#define AUDIO_DEVICE_DESCRIPTOR_TYPE 0x21 -#define AUDIO_CONFIGURATION_DESCRIPTOR_TYPE 0x22 -#define AUDIO_STRING_DESCRIPTOR_TYPE 0x23 -#define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24 -#define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25 - - -/* Audio Control Interface Descriptor Subtypes */ -#define AUDIO_CONTROL_UNDEFINED 0x00 -#define AUDIO_CONTROL_HEADER 0x01 -#define AUDIO_CONTROL_INPUT_TERMINAL 0x02 -#define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03 -#define AUDIO_CONTROL_MIXER_UNIT 0x04 -#define AUDIO_CONTROL_SELECTOR_UNIT 0x05 -#define AUDIO_CONTROL_FEATURE_UNIT 0x06 -#define AUDIO_CONTROL_PROCESSING_UNIT 0x07 -#define AUDIO_CONTROL_EXTENSION_UNIT 0x08 - -/* Audio Streaming Interface Descriptor Subtypes */ -#define AUDIO_STREAMING_UNDEFINED 0x00 -#define AUDIO_STREAMING_GENERAL 0x01 -#define AUDIO_STREAMING_FORMAT_TYPE 0x02 -#define AUDIO_STREAMING_FORMAT_SPECIFIC 0x03 - -/* Audio Endpoint Descriptor Subtypes */ -#define AUDIO_ENDPOINT_UNDEFINED 0x00 -#define AUDIO_ENDPOINT_GENERAL 0x01 - - -/* Audio Descriptor Sizes */ -#define AUDIO_CONTROL_INTERFACE_DESC_SZ(n) 0x08+n -#define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07 -#define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0C -#define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09 -#define AUDIO_MIXER_UNIT_DESC_SZ(p,n) 0x0A+p+n -#define AUDIO_SELECTOR_UNIT_DESC_SZ(p) 0x06+p -#define AUDIO_FEATURE_UNIT_DESC_SZ(ch,n) 0x07+(ch+1)*n -#define AUDIO_PROCESSING_UNIT_DESC_SZ(p,n,x) 0x0D+p+n+x -#define AUDIO_EXTENSION_UNIT_DESC_SZ(p,n) 0x0D+p+n -#define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09 -#define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07 - - -/* Audio Processing Unit Process Types */ -#define AUDIO_UNDEFINED_PROCESS 0x00 -#define AUDIO_UP_DOWN_MIX_PROCESS 0x01 -#define AUDIO_DOLBY_PROLOGIC_PROCESS 0x02 -#define AUDIO_3D_STEREO_PROCESS 0x03 -#define AUDIO_REVERBERATION_PROCESS 0x04 -#define AUDIO_CHORUS_PROCESS 0x05 -#define AUDIO_DYN_RANGE_COMP_PROCESS 0x06 - - -/* Audio Request Codes */ -#define AUDIO_REQUEST_UNDEFINED 0x00 -#define AUDIO_REQUEST_SET_CUR 0x01 -#define AUDIO_REQUEST_GET_CUR 0x81 -#define AUDIO_REQUEST_SET_MIN 0x02 -#define AUDIO_REQUEST_GET_MIN 0x82 -#define AUDIO_REQUEST_SET_MAX 0x03 -#define AUDIO_REQUEST_GET_MAX 0x83 -#define AUDIO_REQUEST_SET_RES 0x04 -#define AUDIO_REQUEST_GET_RES 0x84 -#define AUDIO_REQUEST_SET_MEM 0x05 -#define AUDIO_REQUEST_GET_MEM 0x85 -#define AUDIO_REQUEST_GET_STAT 0xFF - - -/* Audio Control Selector Codes */ -#define AUDIO_CONTROL_UNDEFINED 0x00 /* Common Selector */ - -/* Terminal Control Selectors */ -#define AUDIO_COPY_PROTECT_CONTROL 0x01 - -/* Feature Unit Control Selectors */ -#define AUDIO_MUTE_CONTROL 0x01 -#define AUDIO_VOLUME_CONTROL 0x02 -#define AUDIO_BASS_CONTROL 0x03 -#define AUDIO_MID_CONTROL 0x04 -#define AUDIO_TREBLE_CONTROL 0x05 -#define AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06 -#define AUDIO_AUTOMATIC_GAIN_CONTROL 0x07 -#define AUDIO_DELAY_CONTROL 0x08 -#define AUDIO_BASS_BOOST_CONTROL 0x09 -#define AUDIO_LOUDNESS_CONTROL 0x0A - -/* Processing Unit Control Selectors: */ -#define AUDIO_ENABLE_CONTROL 0x01 /* Common Selector */ -#define AUDIO_MODE_SELECT_CONTROL 0x02 /* Common Selector */ - -/* - Up/Down-mix Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -/* AUDIO_MODE_SELECT_CONTROL 0x02 Common Selector */ - -/* - Dolby Prologic Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -/* AUDIO_MODE_SELECT_CONTROL 0x02 Common Selector */ - -/* - 3D Stereo Extender Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -#define AUDIO_SPACIOUSNESS_CONTROL 0x02 - -/* - Reverberation Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -#define AUDIO_REVERB_LEVEL_CONTROL 0x02 -#define AUDIO_REVERB_TIME_CONTROL 0x03 -#define AUDIO_REVERB_FEEDBACK_CONTROL 0x04 - -/* - Chorus Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -#define AUDIO_CHORUS_LEVEL_CONTROL 0x02 -#define AUDIO_SHORUS_RATE_CONTROL 0x03 -#define AUDIO_CHORUS_DEPTH_CONTROL 0x04 - -/* - Dynamic Range Compressor Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ -#define AUDIO_COMPRESSION_RATE_CONTROL 0x02 -#define AUDIO_MAX_AMPL_CONTROL 0x03 -#define AUDIO_THRESHOLD_CONTROL 0x04 -#define AUDIO_ATTACK_TIME_CONTROL 0x05 -#define AUDIO_RELEASE_TIME_CONTROL 0x06 - -/* Extension Unit Control Selectors */ -/* AUDIO_ENABLE_CONTROL 0x01 Common Selector */ - -/* Endpoint Control Selectors */ -#define AUDIO_SAMPLING_FREQ_CONTROL 0x01 -#define AUDIO_PITCH_CONTROL 0x02 - - -/* Audio Format Specific Control Selectors */ - -/* MPEG Control Selectors */ -#define AUDIO_MPEG_CONTROL_UNDEFINED 0x00 -#define AUDIO_MPEG_DUAL_CHANNEL_CONTROL 0x01 -#define AUDIO_MPEG_SECOND_STEREO_CONTROL 0x02 -#define AUDIO_MPEG_MULTILINGUAL_CONTROL 0x03 -#define AUDIO_MPEG_DYN_RANGE_CONTROL 0x04 -#define AUDIO_MPEG_SCALING_CONTROL 0x05 -#define AUDIO_MPEG_HILO_SCALING_CONTROL 0x06 - -/* AC-3 Control Selectors */ -#define AUDIO_AC3_CONTROL_UNDEFINED 0x00 -#define AUDIO_AC3_MODE_CONTROL 0x01 -#define AUDIO_AC3_DYN_RANGE_CONTROL 0x02 -#define AUDIO_AC3_SCALING_CONTROL 0x03 -#define AUDIO_AC3_HILO_SCALING_CONTROL 0x04 - - -/* Audio Format Types */ -#define AUDIO_FORMAT_TYPE_UNDEFINED 0x00 -#define AUDIO_FORMAT_TYPE_I 0x01 -#define AUDIO_FORMAT_TYPE_II 0x02 -#define AUDIO_FORMAT_TYPE_III 0x03 - - -/* Audio Format Type Descriptor Sizes */ -#define AUDIO_FORMAT_TYPE_I_DESC_SZ(n) 0x08+(n*3) -#define AUDIO_FORMAT_TYPE_II_DESC_SZ(n) 0x09+(n*3) -#define AUDIO_FORMAT_TYPE_III_DESC_SZ(n) 0x08+(n*3) -#define AUDIO_FORMAT_MPEG_DESC_SIZE 0x09 -#define AUDIO_FORMAT_AC3_DESC_SIZE 0x0A - - -/* Audio Data Format Codes */ - -/* Audio Data Format Type I Codes */ -#define AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0000 -#define AUDIO_FORMAT_PCM 0x0001 -#define AUDIO_FORMAT_PCM8 0x0002 -#define AUDIO_FORMAT_IEEE_FLOAT 0x0003 -#define AUDIO_FORMAT_ALAW 0x0004 -#define AUDIO_FORMAT_MULAW 0x0005 - -/* Audio Data Format Type II Codes */ -#define AUDIO_FORMAT_TYPE_II_UNDEFINED 0x1000 -#define AUDIO_FORMAT_MPEG 0x1001 -#define AUDIO_FORMAT_AC3 0x1002 - -/* Audio Data Format Type III Codes */ -#define AUDIO_FORMAT_TYPE_III_UNDEFINED 0x2000 -#define AUDIO_FORMAT_IEC1937_AC3 0x2001 -#define AUDIO_FORMAT_IEC1937_MPEG1_L1 0x2002 -#define AUDIO_FORMAT_IEC1937_MPEG1_L2_3 0x2003 -#define AUDIO_FORMAT_IEC1937_MPEG2_NOEXT 0x2003 -#define AUDIO_FORMAT_IEC1937_MPEG2_EXT 0x2004 -#define AUDIO_FORMAT_IEC1937_MPEG2_L1_LS 0x2005 -#define AUDIO_FORMAT_IEC1937_MPEG2_L2_3 0x2006 - - -/* Predefined Audio Channel Configuration Bits */ -#define AUDIO_CHANNEL_M 0x0000 /* Mono */ -#define AUDIO_CHANNEL_L 0x0001 /* Left Front */ -#define AUDIO_CHANNEL_R 0x0002 /* Right Front */ -#define AUDIO_CHANNEL_C 0x0004 /* Center Front */ -#define AUDIO_CHANNEL_LFE 0x0008 /* Low Freq. Enhance. */ -#define AUDIO_CHANNEL_LS 0x0010 /* Left Surround */ -#define AUDIO_CHANNEL_RS 0x0020 /* Right Surround */ -#define AUDIO_CHANNEL_LC 0x0040 /* Left of Center */ -#define AUDIO_CHANNEL_RC 0x0080 /* Right of Center */ -#define AUDIO_CHANNEL_S 0x0100 /* Surround */ -#define AUDIO_CHANNEL_SL 0x0200 /* Side Left */ -#define AUDIO_CHANNEL_SR 0x0400 /* Side Right */ -#define AUDIO_CHANNEL_T 0x0800 /* Top */ - - -/* Feature Unit Control Bits */ -#define AUDIO_CONTROL_MUTE 0x0001 -#define AUDIO_CONTROL_VOLUME 0x0002 -#define AUDIO_CONTROL_BASS 0x0004 -#define AUDIO_CONTROL_MID 0x0008 -#define AUDIO_CONTROL_TREBLE 0x0010 -#define AUDIO_CONTROL_GRAPHIC_EQUALIZER 0x0020 -#define AUDIO_CONTROL_AUTOMATIC_GAIN 0x0040 -#define AUDIO_CONTROL_DEALY 0x0080 -#define AUDIO_CONTROL_BASS_BOOST 0x0100 -#define AUDIO_CONTROL_LOUDNESS 0x0200 - -/* Processing Unit Control Bits: */ -#define AUDIO_CONTROL_ENABLE 0x0001 /* Common Bit */ -#define AUDIO_CONTROL_MODE_SELECT 0x0002 /* Common Bit */ - -/* - Up/Down-mix Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -/* AUDIO_CONTROL_MODE_SELECT 0x0002 Common Bit */ - -/* - Dolby Prologic Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -/* AUDIO_CONTROL_MODE_SELECT 0x0002 Common Bit */ - -/* - 3D Stereo Extender Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -#define AUDIO_CONTROL_SPACIOUSNESS 0x0002 - -/* - Reverberation Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -#define AUDIO_CONTROL_REVERB_TYPE 0x0002 -#define AUDIO_CONTROL_REVERB_LEVEL 0x0004 -#define AUDIO_CONTROL_REVERB_TIME 0x0008 -#define AUDIO_CONTROL_REVERB_FEEDBACK 0x0010 - -/* - Chorus Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -#define AUDIO_CONTROL_CHORUS_LEVEL 0x0002 -#define AUDIO_CONTROL_SHORUS_RATE 0x0004 -#define AUDIO_CONTROL_CHORUS_DEPTH 0x0008 - -/* - Dynamic Range Compressor Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ -#define AUDIO_CONTROL_COMPRESSION_RATE 0x0002 -#define AUDIO_CONTROL_MAX_AMPL 0x0004 -#define AUDIO_CONTROL_THRESHOLD 0x0008 -#define AUDIO_CONTROL_ATTACK_TIME 0x0010 -#define AUDIO_CONTROL_RELEASE_TIME 0x0020 - -/* Extension Unit Control Bits */ -/* AUDIO_CONTROL_ENABLE 0x0001 Common Bit */ - -/* Endpoint Control Bits */ -#define AUDIO_CONTROL_SAMPLING_FREQ 0x01 -#define AUDIO_CONTROL_PITCH 0x02 -#define AUDIO_MAX_PACKETS_ONLY 0x80 - - -/* Audio Terminal Types */ - -/* USB Terminal Types */ -#define AUDIO_TERMINAL_USB_UNDEFINED 0x0100 -#define AUDIO_TERMINAL_USB_STREAMING 0x0101 -#define AUDIO_TERMINAL_USB_VENDOR_SPECIFIC 0x01FF - -/* Input Terminal Types */ -#define AUDIO_TERMINAL_INPUT_UNDEFINED 0x0200 -#define AUDIO_TERMINAL_MICROPHONE 0x0201 -#define AUDIO_TERMINAL_DESKTOP_MICROPHONE 0x0202 -#define AUDIO_TERMINAL_PERSONAL_MICROPHONE 0x0203 -#define AUDIO_TERMINAL_OMNI_DIR_MICROPHONE 0x0204 -#define AUDIO_TERMINAL_MICROPHONE_ARRAY 0x0205 -#define AUDIO_TERMINAL_PROCESSING_MIC_ARRAY 0x0206 - -/* Output Terminal Types */ -#define AUDIO_TERMINAL_OUTPUT_UNDEFINED 0x0300 -#define AUDIO_TERMINAL_SPEAKER 0x0301 -#define AUDIO_TERMINAL_HEADPHONES 0x0302 -#define AUDIO_TERMINAL_HEAD_MOUNTED_AUDIO 0x0303 -#define AUDIO_TERMINAL_DESKTOP_SPEAKER 0x0304 -#define AUDIO_TERMINAL_ROOM_SPEAKER 0x0305 -#define AUDIO_TERMINAL_COMMUNICATION_SPEAKER 0x0306 -#define AUDIO_TERMINAL_LOW_FREQ_SPEAKER 0x0307 - -/* Bi-directional Terminal Types */ -#define AUDIO_TERMINAL_BIDIRECTIONAL_UNDEFINED 0x0400 -#define AUDIO_TERMINAL_HANDSET 0x0401 -#define AUDIO_TERMINAL_HEAD_MOUNTED_HANDSET 0x0402 -#define AUDIO_TERMINAL_SPEAKERPHONE 0x0403 -#define AUDIO_TERMINAL_SPEAKERPHONE_ECHOSUPRESS 0x0404 -#define AUDIO_TERMINAL_SPEAKERPHONE_ECHOCANCEL 0x0405 - -/* Telephony Terminal Types */ -#define AUDIO_TERMINAL_TELEPHONY_UNDEFINED 0x0500 -#define AUDIO_TERMINAL_PHONE_LINE 0x0501 -#define AUDIO_TERMINAL_TELEPHONE 0x0502 -#define AUDIO_TERMINAL_DOWN_LINE_PHONE 0x0503 - -/* External Terminal Types */ -#define AUDIO_TERMINAL_EXTERNAL_UNDEFINED 0x0600 -#define AUDIO_TERMINAL_ANALOG_CONNECTOR 0x0601 -#define AUDIO_TERMINAL_DIGITAL_AUDIO_INTERFACE 0x0602 -#define AUDIO_TERMINAL_LINE_CONNECTOR 0x0603 -#define AUDIO_TERMINAL_LEGACY_AUDIO_CONNECTOR 0x0604 -#define AUDIO_TERMINAL_SPDIF_INTERFACE 0x0605 -#define AUDIO_TERMINAL_1394_DA_STREAM 0x0606 -#define AUDIO_TERMINAL_1394_DA_STREAM_TRACK 0x0607 - -/* Embedded Function Terminal Types */ -#define AUDIO_TERMINAL_EMBEDDED_UNDEFINED 0x0700 -#define AUDIO_TERMINAL_CALIBRATION_NOISE 0x0701 -#define AUDIO_TERMINAL_EQUALIZATION_NOISE 0x0702 -#define AUDIO_TERMINAL_CD_PLAYER 0x0703 -#define AUDIO_TERMINAL_DAT 0x0704 -#define AUDIO_TERMINAL_DCC 0x0705 -#define AUDIO_TERMINAL_MINI_DISK 0x0706 -#define AUDIO_TERMINAL_ANALOG_TAPE 0x0707 -#define AUDIO_TERMINAL_PHONOGRAPH 0x0708 -#define AUDIO_TERMINAL_VCR_AUDIO 0x0709 -#define AUDIO_TERMINAL_VIDEO_DISC_AUDIO 0x070A -#define AUDIO_TERMINAL_DVD_AUDIO 0x070B -#define AUDIO_TERMINAL_TV_TUNER_AUDIO 0x070C -#define AUDIO_TERMINAL_SATELLITE_RECEIVER_AUDIO 0x070D -#define AUDIO_TERMINAL_CABLE_TUNER_AUDIO 0x070E -#define AUDIO_TERMINAL_DSS_AUDIO 0x070F -#define AUDIO_TERMINAL_RADIO_RECEIVER 0x0710 -#define AUDIO_TERMINAL_RADIO_TRANSMITTER 0x0711 -#define AUDIO_TERMINAL_MULTI_TRACK_RECORDER 0x0712 -#define AUDIO_TERMINAL_SYNTHESIZER 0x0713 - - -#endif /* __AUDIO_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdc.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdc.h deleted file mode 100644 index 6754a5cce..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdc.h +++ /dev/null @@ -1,255 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_cdc.h 165 2011-04-14 17:41:11Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Communication Device Class User module Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __CDC_H -#define __CDC_H - -#include "usbd.h" - -/*---------------------------------------------------------------------------- - * Definitions based on usbcdc11.pdf (www.usb.org) - *---------------------------------------------------------------------------*/ -/* Communication device class specification version 1.10 */ -#define CDC_V1_10 0x0110 - -/* Communication interface class code */ -/* (usbcdc11.pdf, 4.2, Table 15) */ -#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 - -/* Communication interface class subclass codes */ -/* (usbcdc11.pdf, 4.3, Table 16) */ -#define CDC_DIRECT_LINE_CONTROL_MODEL 0x01 -#define CDC_ABSTRACT_CONTROL_MODEL 0x02 -#define CDC_TELEPHONE_CONTROL_MODEL 0x03 -#define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04 -#define CDC_CAPI_CONTROL_MODEL 0x05 -#define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06 -#define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07 - -/* Communication interface class control protocol codes */ -/* (usbcdc11.pdf, 4.4, Table 17) */ -#define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01 - -/* Data interface class code */ -/* (usbcdc11.pdf, 4.5, Table 18) */ -#define CDC_DATA_INTERFACE_CLASS 0x0A - -/* Data interface class protocol codes */ -/* (usbcdc11.pdf, 4.7, Table 19) */ -#define CDC_PROTOCOL_ISDN_BRI 0x30 -#define CDC_PROTOCOL_HDLC 0x31 -#define CDC_PROTOCOL_TRANSPARENT 0x32 -#define CDC_PROTOCOL_Q921_MANAGEMENT 0x50 -#define CDC_PROTOCOL_Q921_DATA_LINK 0x51 -#define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52 -#define CDC_PROTOCOL_V42 0x90 -#define CDC_PROTOCOL_EURO_ISDN 0x91 -#define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92 -#define CDC_PROTOCOL_CAPI 0x93 -#define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD -#define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE - -/* Type values for bDescriptorType field of functional descriptors */ -/* (usbcdc11.pdf, 5.2.3, Table 24) */ -#define CDC_CS_INTERFACE 0x24 -#define CDC_CS_ENDPOINT 0x25 - -/* Type values for bDescriptorSubtype field of functional descriptors */ -/* (usbcdc11.pdf, 5.2.3, Table 25) */ -#define CDC_HEADER 0x00 -#define CDC_CALL_MANAGEMENT 0x01 -#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 -#define CDC_DIRECT_LINE_MANAGEMENT 0x03 -#define CDC_TELEPHONE_RINGER 0x04 -#define CDC_REPORTING_CAPABILITIES 0x05 -#define CDC_UNION 0x06 -#define CDC_COUNTRY_SELECTION 0x07 -#define CDC_TELEPHONE_OPERATIONAL_MODES 0x08 -#define CDC_USB_TERMINAL 0x09 -#define CDC_NETWORK_CHANNEL 0x0A -#define CDC_PROTOCOL_UNIT 0x0B -#define CDC_EXTENSION_UNIT 0x0C -#define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D -#define CDC_CAPI_CONTROL_MANAGEMENT 0x0E -#define CDC_ETHERNET_NETWORKING 0x0F -#define CDC_ATM_NETWORKING 0x10 - -/* CDC class-specific request codes */ -/* (usbcdc11.pdf, 6.2, Table 46) */ -/* see Table 45 for info about the specific requests. */ -#define CDC_SEND_ENCAPSULATED_COMMAND 0x00 -#define CDC_GET_ENCAPSULATED_RESPONSE 0x01 -#define CDC_SET_COMM_FEATURE 0x02 -#define CDC_GET_COMM_FEATURE 0x03 -#define CDC_CLEAR_COMM_FEATURE 0x04 -#define CDC_SET_AUX_LINE_STATE 0x10 -#define CDC_SET_HOOK_STATE 0x11 -#define CDC_PULSE_SETUP 0x12 -#define CDC_SEND_PULSE 0x13 -#define CDC_SET_PULSE_TIME 0x14 -#define CDC_RING_AUX_JACK 0x15 -#define CDC_SET_LINE_CODING 0x20 -#define CDC_GET_LINE_CODING 0x21 -#define CDC_SET_CONTROL_LINE_STATE 0x22 -#define CDC_SEND_BREAK 0x23 -#define CDC_SET_RINGER_PARMS 0x30 -#define CDC_GET_RINGER_PARMS 0x31 -#define CDC_SET_OPERATION_PARMS 0x32 -#define CDC_GET_OPERATION_PARMS 0x33 -#define CDC_SET_LINE_PARMS 0x34 -#define CDC_GET_LINE_PARMS 0x35 -#define CDC_DIAL_DIGITS 0x36 -#define CDC_SET_UNIT_PARAMETER 0x37 -#define CDC_GET_UNIT_PARAMETER 0x38 -#define CDC_CLEAR_UNIT_PARAMETER 0x39 -#define CDC_GET_PROFILE 0x3A -#define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 -#define CDC_SET_ETHERNET_PMP_FILTER 0x41 -#define CDC_GET_ETHERNET_PMP_FILTER 0x42 -#define CDC_SET_ETHERNET_PACKET_FILTER 0x43 -#define CDC_GET_ETHERNET_STATISTIC 0x44 -#define CDC_SET_ATM_DATA_FORMAT 0x50 -#define CDC_GET_ATM_DEVICE_STATISTICS 0x51 -#define CDC_SET_ATM_DEFAULT_VC 0x52 -#define CDC_GET_ATM_VC_STATISTICS 0x53 - -/* Communication feature selector codes */ -/* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */ -#define CDC_ABSTRACT_STATE 0x01 -#define CDC_COUNTRY_SETTING 0x02 - -/* Feature Status returned for ABSTRACT_STATE Selector */ -/* (usbcdc11.pdf, 6.2.3, Table 48) */ -#define CDC_IDLE_SETTING (1 << 0) -#define CDC_DATA_MULTPLEXED_STATE (1 << 1) - - -/* Control signal bitmap values for the SetControlLineState request */ -/* (usbcdc11.pdf, 6.2.14, Table 51) */ -#define CDC_DTE_PRESENT (1 << 0) -#define CDC_ACTIVATE_CARRIER (1 << 1) - -/* CDC class-specific notification codes */ -/* (usbcdc11.pdf, 6.3, Table 68) */ -/* see Table 67 for Info about class-specific notifications */ -#define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 -#define CDC_RESPONSE_AVAILABLE 0x01 -#define CDC_AUX_JACK_HOOK_STATE 0x08 -#define CDC_RING_DETECT 0x09 -#define CDC_NOTIFICATION_SERIAL_STATE 0x20 -#define CDC_CALL_STATE_CHANGE 0x28 -#define CDC_LINE_STATE_CHANGE 0x29 -#define CDC_CONNECTION_SPEED_CHANGE 0x2A - -/* UART state bitmap values (Serial state notification). */ -/* (usbcdc11.pdf, 6.3.5, Table 69) */ -#define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */ -#define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */ -#define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */ -#define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */ -#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */ -#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */ -#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */ - - -/*---------------------------------------------------------------------------- - * Structures based on usbcdc11.pdf (www.usb.org) - *---------------------------------------------------------------------------*/ - -/* Header functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.1) */ -/* This header must precede any list of class-specific descriptors. */ -PRE_PACK struct POST_PACK _CDC_HEADER_DESCRIPTOR{ - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */ - uint16_t bcdCDC; /* USB CDC specification release version */ -}; -typedef struct _CDC_HEADER_DESCRIPTOR CDC_HEADER_DESCRIPTOR; - -/* Call management functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.2) */ -/* Describes the processing of calls for the communication class interface. */ -PRE_PACK struct POST_PACK _CDC_CALL_MANAGEMENT_DESCRIPTOR { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* call management functional descriptor subtype */ - uint8_t bmCapabilities; /* capabilities that this configuration supports */ - uint8_t bDataInterface; /* interface number of the data class interface used for call management (optional) */ -}; -typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR CDC_CALL_MANAGEMENT_DESCRIPTOR; - -/* Abstract control management functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.3) */ -/* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */ -PRE_PACK struct POST_PACK _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */ - uint8_t bmCapabilities; /* capabilities supported by this configuration */ -}; -typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR; - -/* Union functional descriptors */ -/* (usbcdc11.pdf, 5.2.3.8) */ -/* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */ -PRE_PACK struct POST_PACK _CDC_UNION_DESCRIPTOR { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* union functional descriptor subtype */ - uint8_t bMasterInterface; /* interface number designated as master */ -}; -typedef struct _CDC_UNION_DESCRIPTOR CDC_UNION_DESCRIPTOR; - -/* Union functional descriptors with one slave interface */ -/* (usbcdc11.pdf, 5.2.3.8) */ -PRE_PACK struct POST_PACK _CDC_UNION_1SLAVE_DESCRIPTOR { - CDC_UNION_DESCRIPTOR sUnion; /* Union functional descriptor */ - uint8_t bSlaveInterfaces[1]; /* Slave interface 0 */ -}; -typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR CDC_UNION_1SLAVE_DESCRIPTOR; - -/* Line coding structure */ -/* Format of the data returned when a GetLineCoding request is received */ -/* (usbcdc11.pdf, 6.2.13) */ -PRE_PACK struct POST_PACK _CDC_LINE_CODING { - uint32_t dwDTERate; /* Data terminal rate in bits per second */ - uint8_t bCharFormat; /* Number of stop bits */ - uint8_t bParityType; /* Parity bit type */ - uint8_t bDataBits; /* Number of data bits */ -}; -typedef struct _CDC_LINE_CODING CDC_LINE_CODING; - -/* Notification header */ -/* Data sent on the notification endpoint must follow this header. */ -/* see USB_SETUP_PACKET in file usb.h */ -typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER; - -#endif /* __CDC_H */ - - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdcuser.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdcuser.h deleted file mode 100644 index 75ff2033e..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_cdcuser.h +++ /dev/null @@ -1,535 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_cdcuser.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Communication Device Class User module Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __CDCUSER_H__ -#define __CDCUSER_H__ - -#include "error.h" -#include "usbd.h" -#include "usbd_cdc.h" - -/** \file - * \brief Communication Device Class (CDC) API structures and function prototypes. - * - * Definition of functions exported by ROM based CDC function driver. - * - */ - -/** \ingroup Group_USBD - * @defgroup USBD_CDC Communication Device Class (CDC) Function Driver - * \section Sec_CDCModDescription Module Description - * CDC Class Function Driver module. This module contains an internal implementation of the USB CDC Class. - * - * User applications can use this class driver instead of implementing the CDC-ACM class manually - * via the low-level USBD_HW and USBD_Core APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB CDC-ACM Class. - */ - -/*---------------------------------------------------------------------------- - We need a buffer for incoming data on USB port because USB receives - much faster than UART transmits - *---------------------------------------------------------------------------*/ -/* Buffer masks */ -#define CDC_BUF_SIZE (128) /* Output buffer in bytes (power 2) */ - /* large enough for file transfer */ -#define CDC_BUF_MASK (CDC_BUF_SIZE-1ul) - -/** \brief Communication Device Class function driver initialization parameter data structure. - * \ingroup USBD_CDC - * - * \details This data structure is used to pass initialization parameters to the - * Communication Device Class function driver's init function. - * - */ -typedef struct USBD_CDC_INIT_PARAM -{ - /* memory allocation params */ - uint32_t mem_base; /**< Base memory location from where the stack can allocate - data and buffers. \note The memory address set in this field - should be accessible by USB DMA controller. Also this value - should be aligned on 4 byte boundary. - */ - uint32_t mem_size; /**< The size of memory buffer which stack can use. - \note The \em mem_size should be greater than the size - returned by USBD_CDC_API::GetMemSize() routine.*/ - /** Pointer to the control interface descriptor within the descriptor - * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T - * structure. The stack assumes both HS and FS use same BULK endpoints. - */ - uint8_t* cif_intf_desc; - /** Pointer to the data interface descriptor within the descriptor - * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T - * structure. The stack assumes both HS and FS use same BULK endpoints. - */ - uint8_t* dif_intf_desc; - - /* user defined functions */ - - /* required functions */ - /** - * Communication Interface Class specific get request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends CIC management element get requests. - * \note Applications implementing Abstract Control Model subclass can set this - * param to NULL. As the default driver parses ACM requests and calls the - * individual ACM call-back routines defined in this structure. For all other subclasses - * this routine should be provided by the application. - * \n - * The setup packet data (\em pSetup) is passed to the call-back so that application - * can extract the CIC request type and other associated data. By default the stack - * will assign \em pBuffer pointer to \em EP0Buff allocated at init. The application - * code can directly write data into this buffer as long as data is less than 64 byte. - * If more data has to be sent then application code should update \em pBuffer pointer - * and length accordingly. - * - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in, out] pBuffer Pointer to a pointer of data buffer containing request data. - * Pointer-to-pointer is used to implement zero-copy buffers. - * See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in, out] length Amount of data to be sent back to host. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CIC_GetRequest)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length); - - /** - * Communication Interface Class specific set request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a CIC management element requests. - * \note Applications implementing Abstract Control Model subclass can set this - * param to NULL. As the default driver parses ACM requests and calls the - * individual ACM call-back routines defined in this structure. For all other subclasses - * this routine should be provided by the application. - * \n - * The setup packet data (\em pSetup) is passed to the call-back so that application can - * extract the CIC request type and other associated data. If a set request has data associated, - * then this call-back is called twice. - * -# First when setup request is received, at this time application code could update - * \em pBuffer pointer to point to the intended destination. The length param is set to 0 - * so that application code knows this is first time. By default the stack will - * assign \em pBuffer pointer to \em EP0Buff allocated at init. Note, if data length is - * greater than 64 bytes and application code doesn't update \em pBuffer pointer the - * stack will send STALL condition to host. - * -# Second when the data is received from the host. This time the length param is set - * with number of data bytes received. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in, out] pBuffer Pointer to a pointer of data buffer containing request data. - * Pointer-to-pointer is used to implement zero-copy buffers. - * See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in] length Amount of data copied to destination buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CIC_SetRequest)( USBD_HANDLE_T hCdc, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length); - - /** - * Communication Device Class specific BULK IN endpoint handler. - * - * The application software should provide the BULK IN endpoint handler. - * Applications should transfer data depending on the communication protocol type set in descriptors. - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CDC_BulkIN_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - - /** - * Communication Device Class specific BULK OUT endpoint handler. - * - * The application software should provide the BULK OUT endpoint handler. - * Applications should transfer data depending on the communication protocol type set in descriptors. - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CDC_BulkOUT_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - - /** - * Abstract control model(ACM) subclass specific SEND_ENCAPSULATED_COMMAND request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a SEND_ENCAPSULATED_COMMAND set request. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] buffer Pointer to the command buffer. - * \param[in] len Length of the command buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*SendEncpsCmd) (USBD_HANDLE_T hCDC, uint8_t* buffer, uint16_t len); - - /** - * Abstract control model(ACM) subclass specific GET_ENCAPSULATED_RESPONSE request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a GET_ENCAPSULATED_RESPONSE request. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in, out] buffer Pointer to a pointer of data buffer containing response data. - * Pointer-to-pointer is used to implement zero-copy buffers. - * See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in, out] len Amount of data to be sent back to host. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*GetEncpsResp) (USBD_HANDLE_T hCDC, uint8_t** buffer, uint16_t* len); - - /** - * Abstract control model(ACM) subclass specific SET_COMM_FEATURE request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a SET_COMM_FEATURE set request. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47. - * \param[in] buffer Pointer to the settings buffer for the specified communication feature. - * \param[in] len Length of the request buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*SetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t* buffer, uint16_t len); - - /** - * Abstract control model(ACM) subclass specific GET_COMM_FEATURE request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a GET_ENCAPSULATED_RESPONSE request. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47. - * \param[in, out] buffer Pointer to a pointer of data buffer containing current settings - * for the communication feature. - * Pointer-to-pointer is used to implement zero-copy buffers. - * \param[in, out] len Amount of data to be sent back to host. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*GetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t** pBuffer, uint16_t* len); - - /** - * Abstract control model(ACM) subclass specific CLEAR_COMM_FEATURE request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a CLEAR_COMM_FEATURE request. In the call-back the application - * should Clears the settings for a particular communication feature. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] feature Communication feature type. See usbcdc11.pdf, section 6.2.4, Table 47. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*ClrCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature); - - /** - * Abstract control model(ACM) subclass specific SET_CONTROL_LINE_STATE request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a SET_CONTROL_LINE_STATE request. RS-232 signal used to tell the DCE - * device the DTE device is now present - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] state The state value uses bitmap values defined in usbcdc11.pdf, - * section 6.2.14, Table 51. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*SetCtrlLineState) (USBD_HANDLE_T hCDC, uint16_t state); - - /** - * Abstract control model(ACM) subclass specific SEND_BREAK request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a SEND_BREAK request. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] mstime Duration of Break signal in milliseconds. If mstime is FFFFh, then - * the application should send break until another SendBreak request is received - * with the wValue of 0000h. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*SendBreak) (USBD_HANDLE_T hCDC, uint16_t mstime); - - /** - * Abstract control model(ACM) subclass specific SET_LINE_CODING request call-back function. - * - * This function is provided by the application software. This function gets called - * when host sends a SET_LINE_CODING request. The application should configure the device - * per DTE rate, stop-bits, parity, and number-of-character bits settings provided in - * command buffer. See usbcdc11.pdf, section 6.2.13, table 50 for detail of the command buffer. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] line_coding Pointer to the CDC_LINE_CODING command buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*SetLineCode) (USBD_HANDLE_T hCDC, CDC_LINE_CODING* line_coding); - - /** - * Optional Communication Device Class specific INTERRUPT IN endpoint handler. - * - * The application software should provide the INT IN endpoint handler. - * Applications should transfer data depending on the communication protocol type set in descriptors. - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CDC_InterruptEP_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - - /** - * Optional user override-able function to replace the default CDC class handler. - * - * The application software could override the default EP0 class handler with their - * own by providing the handler function address as this data member of the parameter - * structure. Application which like the default handler should set this data member - * to zero before calling the USBD_CDC_API::Init(). - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*CDC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - -} USBD_CDC_INIT_PARAM_T; - -/** \brief CDC class API functions structure. - * \ingroup USBD_CDC - * - * This module exposes functions which interact directly with USB device controller hardware. - * - */ -typedef struct USBD_CDC_API -{ - /** \fn uint32_t GetMemSize(USBD_CDC_INIT_PARAM_T* param) - * Function to determine the memory required by the CDC function driver module. - * - * This function is called by application layer before calling pUsbApi->CDC->Init(), to allocate memory used - * by CDC function driver module. The application should allocate the memory which is accessible by USB - * controller/DMA controller. - * \note Some memory areas are not accessible by all bus masters. - * - * \param[in] param Structure containing CDC function driver module initialization parameters. - * \return Returns the required memory size in bytes. - */ - uint32_t (*GetMemSize)(USBD_CDC_INIT_PARAM_T* param); - - /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param) - * Function to initialize CDC function driver module. - * - * This function is called by application layer to initialize CDC function driver module. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in, out] param Structure containing CDC function driver module initialization parameters. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte - * aligned or smaller than required. - * \retval ERR_API_INVALID_PARAM2 Either CDC_Write() or CDC_Read() or - * CDC_Verify() callbacks are not defined. - * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed. - * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed. - */ - ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param, USBD_HANDLE_T* phCDC); - - /** \fn ErrorCode_t SendNotification(USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data) - * Function to send CDC class notifications to host. - * - * This function is called by application layer to send CDC class notifications to host. - * See usbcdc11.pdf, section 6.3, Table 67 for various notification types the CDC device can send. - * \note The current version of the driver only supports following notifications allowed by ACM subclass: - * CDC_NOTIFICATION_NETWORK_CONNECTION, CDC_RESPONSE_AVAILABLE, CDC_NOTIFICATION_SERIAL_STATE. - * \n - * For all other notifications application should construct the notification buffer appropriately - * and call hw->USB_WriteEP() for interrupt endpoint associated with the interface. - * - * \param[in] hCdc Handle to CDC function driver. - * \param[in] bNotification Notification type allowed by ACM subclass. Should be CDC_NOTIFICATION_NETWORK_CONNECTION, - * CDC_RESPONSE_AVAILABLE or CDC_NOTIFICATION_SERIAL_STATE. For all other types ERR_API_INVALID_PARAM2 - * is returned. See usbcdc11.pdf, section 3.6.2.1, table 5. - * \param[in] data Data associated with notification. - * \n For CDC_NOTIFICATION_NETWORK_CONNECTION a non-zero data value is interpreted as connected state. - * \n For CDC_RESPONSE_AVAILABLE this parameter is ignored. - * \n For CDC_NOTIFICATION_SERIAL_STATE the data should use bitmap values defined in usbcdc11.pdf, - * section 6.3.5, Table 69. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_API_INVALID_PARAM2 If unsupported notification type is passed. - * - */ - ErrorCode_t (*SendNotification)(USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data); - -} USBD_CDC_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes - *-----------------------------------------------------------------------------*/ -/** @cond ADVANCED_API */ - -typedef struct _CDC_CTRL_T -{ - USB_CORE_CTRL_T* pUsbCtrl; - /* notification buffer */ - uint8_t notice_buf[12]; - CDC_LINE_CODING line_coding; - uint8_t pad0; - - uint8_t cif_num; /* control interface number */ - uint8_t dif_num; /* data interface number */ - uint8_t epin_num; /* BULK IN endpoint number */ - uint8_t epout_num; /* BULK OUT endpoint number */ - uint8_t epint_num; /* Interrupt IN endpoint number */ - uint8_t pad[3]; - /* user defined functions */ - ErrorCode_t (*SendEncpsCmd) (USBD_HANDLE_T hCDC, uint8_t* buffer, uint16_t len); - ErrorCode_t (*GetEncpsResp) (USBD_HANDLE_T hCDC, uint8_t** buffer, uint16_t* len); - ErrorCode_t (*SetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t* buffer, uint16_t len); - ErrorCode_t (*GetCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature, uint8_t** pBuffer, uint16_t* len); - ErrorCode_t (*ClrCommFeature) (USBD_HANDLE_T hCDC, uint16_t feature); - ErrorCode_t (*SetCtrlLineState) (USBD_HANDLE_T hCDC, uint16_t state); - ErrorCode_t (*SendBreak) (USBD_HANDLE_T hCDC, uint16_t state); - ErrorCode_t (*SetLineCode) (USBD_HANDLE_T hCDC, CDC_LINE_CODING* line_coding); - - /* virtual functions */ - ErrorCode_t (*CIC_GetRequest)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length); - ErrorCode_t (*CIC_SetRequest)( USBD_HANDLE_T hCdc, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length); - -} USB_CDC_CTRL_T; - -/* structure used by old ROM drivers, needed for workaround */ -typedef struct _CDC0_CTRL_T { - USB_CORE_CTRL_T *pUsbCtrl; - /* notification buffer */ - uint8_t notice_buf[12]; - CDC_LINE_CODING line_coding; - - uint8_t cif_num; /* control interface number */ - uint8_t dif_num; /* data interface number */ - uint8_t epin_num; /* BULK IN endpoint number */ - uint8_t epout_num; /* BULK OUT endpoint number */ - uint8_t epint_num; /* Interrupt IN endpoint number */ - /* user defined functions */ - ErrorCode_t (*SendEncpsCmd)(USBD_HANDLE_T hCDC, uint8_t *buffer, uint16_t len); - ErrorCode_t (*GetEncpsResp)(USBD_HANDLE_T hCDC, uint8_t * *buffer, uint16_t *len); - ErrorCode_t (*SetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t *buffer, uint16_t len); - ErrorCode_t (*GetCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature, uint8_t * *pBuffer, uint16_t *len); - ErrorCode_t (*ClrCommFeature)(USBD_HANDLE_T hCDC, uint16_t feature); - ErrorCode_t (*SetCtrlLineState)(USBD_HANDLE_T hCDC, uint16_t state); - ErrorCode_t (*SendBreak)(USBD_HANDLE_T hCDC, uint16_t state); - ErrorCode_t (*SetLineCode)(USBD_HANDLE_T hCDC, CDC_LINE_CODING *line_coding); - - /* virtual functions */ - ErrorCode_t (*CIC_GetRequest)(USBD_HANDLE_T hHid, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t *length); - ErrorCode_t (*CIC_SetRequest)(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length); - -} USB_CDC0_CTRL_T; - -typedef ErrorCode_t (*CIC_SetRequest_t)(USBD_HANDLE_T hCdc, USB_SETUP_PACKET *pSetup, uint8_t * *pBuffer, uint16_t length); - -/** @cond DIRECT_API */ -extern uint32_t mwCDC_GetMemSize(USBD_CDC_INIT_PARAM_T* param); -extern ErrorCode_t mwCDC_init(USBD_HANDLE_T hUsb, USBD_CDC_INIT_PARAM_T* param, USBD_HANDLE_T* phCDC); -extern ErrorCode_t mwCDC_SendNotification (USBD_HANDLE_T hCdc, uint8_t bNotification, uint16_t data); -/** @endcond */ - -/** @endcond */ - - - - - -#endif /* __CDCUSER_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_core.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_core.h deleted file mode 100644 index 34729880a..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_core.h +++ /dev/null @@ -1,591 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_core.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB core controller structure definitions and function prototypes. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __MW_USBD_CORE_H__ -#define __MW_USBD_CORE_H__ - -#include "error.h" -#include "usbd.h" -#include "app_usbd_cfg.h" - -/** \file - * \brief ROM API for USB device stack. - * - * Definition of functions exported by core layer of ROM based USB device stack. - * - */ - -/** \ingroup Group_USBD - * @defgroup USBD_Core USB Core Layer - * \section Sec_CoreModDescription Module Description - * The USB Core Layer implements the device abstraction defined in the Universal Serial Bus Specification, - * for applications to interact with the USB device interface on the device. The software in this layer responds to - * standard requests and returns standard descriptors. In current stack the Init() routine part of - * \ref USBD_HW_API_T structure initializes both hardware layer and core layer. - */ - - -/* function pointer types */ - -/** \ingroup USBD_Core - * \typedef USB_CB_T - * \brief USB device stack's event callback function type. - * - * The USB device stack exposes several event triggers through callback to application layer. The - * application layer can register methods to be called when such USB event happens. - * - * \param[in] hUsb Handle to the USB device stack. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx Other error conditions. - * - */ -typedef ErrorCode_t (*USB_CB_T) (USBD_HANDLE_T hUsb); - -/** \ingroup USBD_Core - * \typedef USB_PARAM_CB_T - * \brief USB device stack's event callback function type. - * - * The USB device stack exposes several event triggers through callback to application layer. The - * application layer can register methods to be called when such USB event happens. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] param1 Extra information related to the event. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ -typedef ErrorCode_t (*USB_PARAM_CB_T) (USBD_HANDLE_T hUsb, uint32_t param1); - -/** \ingroup USBD_Core - * \typedef USB_EP_HANDLER_T - * \brief USBD setup request and endpoint event handler type. - * - * The application layer should define the custom class's EP0 handler with function signature. - * The stack calls all the registered class handlers on any EP0 event before going through default - * handling of the event. This gives the class handlers to implement class specific request handlers - * and also to override the default stack handling for a particular event targeted to the interface. - * If an event is not handled by the callback the function should return ERR_USBD_UNHANDLED. For all - * other return codes the stack assumes that callback has taken care of the event and hence will not - * process the event any further and issues a STALL condition on EP0 indicating error to the host. - * \n - * For endpoint interrupt handler the return value is ignored by the stack. - * \n - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ -typedef ErrorCode_t (*USB_EP_HANDLER_T)(USBD_HANDLE_T hUsb, void* data, uint32_t event); - - -/** \ingroup USBD_Core - * \brief USB descriptors data structure. - * \ingroup USBD_Core - * - * \details This structure is used as part of USB device stack initialization - * parameter structure \ref USBD_API_INIT_PARAM_T. This structure contains - * pointers to various descriptor arrays needed by the stack. These descriptors - * are reported to USB host as part of enumerations process. - * - * \note All descriptor pointers assigned in this structure should be on 4 byte - * aligned address boundary. - */ -typedef struct _USB_CORE_DESCS_T -{ - uint8_t *device_desc; /**< Pointer to USB device descriptor */ - uint8_t *string_desc; /**< Pointer to array of USB string descriptors */ - uint8_t *full_speed_desc; /**< Pointer to USB device configuration descriptor - * when device is operating in full speed mode. - */ - uint8_t *high_speed_desc; /**< Pointer to USB device configuration descriptor - * when device is operating in high speed mode. For - * full-speed only implementation this pointer should - * be same as full_speed_desc. - */ - uint8_t *device_qualifier; /**< Pointer to USB device qualifier descriptor. For - * full-speed only implementation this pointer should - * be set to null (0). - */ -} USB_CORE_DESCS_T; - -/** \brief USB device stack initialization parameter data structure. - * \ingroup USBD_Core - * - * \details This data structure is used to pass initialization parameters to the - * USB device stack's init function. - * - */ -typedef struct USBD_API_INIT_PARAM -{ - uint32_t usb_reg_base; /**< USB device controller's base register address. */ - uint32_t mem_base; /**< Base memory location from where the stack can allocate - data and buffers. \note The memory address set in this field - should be accessible by USB DMA controller. Also this value - should be aligned on 2048 byte boundary. - */ - uint32_t mem_size; /**< The size of memory buffer which stack can use. - \note The \em mem_size should be greater than the size - returned by USBD_HW_API::GetMemSize() routine.*/ - uint8_t max_num_ep; /**< max number of endpoints supported by the USB device - controller instance (specified by \em usb_reg_base field) - to which this instance of stack is attached. - */ - uint8_t pad0[3]; - /* USB Device Events Callback Functions */ - /** Event for USB interface reset. This event fires when the USB host requests that the device - * reset its interface. This event fires after the control endpoint has been automatically - * configured by the library. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will prevent the device from enumerating correctly or operate properly. - * - */ - USB_CB_T USB_Reset_Event; - - /** Event for USB suspend. This event fires when the USB host suspends the device by halting its - * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move - * the device over to a low power state until the host wakes up the device. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will cause other system issues. - */ - USB_CB_T USB_Suspend_Event; - - /** Event for USB wake up or resume. This event fires when a the USB device interface is suspended - * and the host wakes up the device by supplying Start Of Frame pulses. This is generally - * hooked to pull the user application out of a low power state and back into normal operating - * mode. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will cause other system issues. - * - */ - USB_CB_T USB_Resume_Event; - - /** Reserved parameter should be set to zero. */ - USB_CB_T reserved_sbz; - - /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB - * frame, once per millisecond in full-speed mode or once per 125 microseconds in high-speed mode, - * and is synchronized to the USB bus. - * - * This event is time-critical; it is run once per millisecond (full-speed mode) and thus long handlers - * will significantly degrade device performance. This event should only be enabled when needed to - * reduce device wake-ups. - * - * \note This event is not normally active - it must be manually enabled and disabled via the USB interrupt - * register. - * \n\n - */ - USB_CB_T USB_SOF_Event; - - /** Event for remote wake-up configuration, when enabled. This event fires when the USB host - * request the device to configure itself for remote wake-up capability. The USB host sends - * this request to device which report remote wake-up capable in their device descriptors, - * before going to low-power state. The application layer should implement this callback if - * they have any special on board circuit to trigger remote wake up event. Also application - * can use this callback to differentiate the following SUSPEND event is caused by cable plug-out - * or host SUSPEND request. The device can wake-up host only after receiving this callback and - * remote wake-up feature is enabled by host. To signal remote wake-up the device has to generate - * resume signaling on bus by calling usapi.hw->WakeUp() routine. - * - * \n\n - * \param[in] hUsb Handle to the USB device stack. - * \param[in] param1 When 0 - Clear the wake-up configuration, 1 - Enable the wake-up configuration. - * \return The call back should return \ref ErrorCode_t type to indicate success or error condition. - */ - USB_PARAM_CB_T USB_WakeUpCfg; - - /** Reserved parameter should be set to zero. */ - USB_PARAM_CB_T USB_Power_Event; - - /** Event for error condition. This event fires when USB device controller detect - * an error condition in the system. - * - * \n\n - * \param[in] hUsb Handle to the USB device stack. - * \param[in] param1 USB device interrupt status register. - * \return The call back should return \ref ErrorCode_t type to indicate success or error condition. - */ - USB_PARAM_CB_T USB_Error_Event; - - /* USB Core Events Callback Functions */ - /** Event for USB configuration number changed. This event fires when a the USB host changes the - * selected configuration number. On receiving configuration change request from host, the stack - * enables/configures the endpoints needed by the new configuration before calling this callback - * function. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will prevent the device from enumerating correctly or operate properly. - * - */ - USB_CB_T USB_Configure_Event; - - /** Event for USB interface setting changed. This event fires when a the USB host changes the - * interface setting to one of alternate interface settings. On receiving interface change - * request from host, the stack enables/configures the endpoints needed by the new alternate - * interface setting before calling this callback function. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will prevent the device from enumerating correctly or operate properly. - * - */ - USB_CB_T USB_Interface_Event; - - /** Event for USB feature changed. This event fires when a the USB host send set/clear feature - * request. The stack handles this request for USB_FEATURE_REMOTE_WAKEUP, USB_FEATURE_TEST_MODE - * and USB_FEATURE_ENDPOINT_STALL features only. On receiving feature request from host, the - * stack handle the request appropriately and then calls this callback function. - * \n - * \note This event is called from USB_ISR context and hence is time-critical. Having delays in this - * callback will prevent the device from enumerating correctly or operate properly. - * - */ - USB_CB_T USB_Feature_Event; - - /* cache and MMU translation functions */ - /** Reserved parameter for future use. should be set to zero. */ - uint32_t (* virt_to_phys)(void* vaddr); - /** Reserved parameter for future use. should be set to zero. */ - void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr); - -} USBD_API_INIT_PARAM_T; - - -/** \brief USBD stack Core API functions structure. - * \ingroup USBD_Core - * - * \details This module exposes functions which interact directly with USB device stack's core layer. - * The application layer uses this component when it has to implement custom class function driver or - * standard class function driver which is not part of the current USB device stack. - * The functions exposed by this interface are to register class specific EP0 handlers and corresponding - * utility functions to manipulate EP0 state machine of the stack. This interface also exposes - * function to register custom endpoint interrupt handler. - * - */ -typedef struct USBD_CORE_API -{ - /** \fn ErrorCode_t RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data) - * Function to register class specific EP0 event handler with USB device stack. - * - * The application layer uses this function when it has to register the custom class's EP0 handler. - * The stack calls all the registered class handlers on any EP0 event before going through default - * handling of the event. This gives the class handlers to implement class specific request handlers - * and also to override the default stack handling for a particular event targeted to the interface. - * Check \ref USB_EP_HANDLER_T for more details on how the callback function should be implemented. Also - * application layer could use this function to register EP0 handler which responds to vendor specific - * requests. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] pfn Class specific EP0 handler function. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_TOO_MANY_CLASS_HDLR(0x0004000c) The number of class handlers registered is - greater than the number of handlers allowed by the stack. - * - */ - ErrorCode_t (*RegisterClassHandler)(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data); - - /** \fn ErrorCode_t RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data) - * Function to register interrupt/event handler for the requested endpoint with USB device stack. - * - * The application layer uses this function to register the endpoint event handler. - * The stack calls all the registered endpoint handlers when - * - USB_EVT_OUT or USB_EVT_OUT_NAK events happen for OUT endpoint. - * - USB_EVT_IN or USB_EVT_IN_NAK events happen for IN endpoint. - * Check USB_EP_HANDLER_T for more details on how the callback function should be implemented. - * \note By default endpoint _NAK events are not enabled. Application should call \ref USBD_HW_API_T::EnableEvent - * for the corresponding endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] ep_index Endpoint index. Computed as - * - For OUT endpoints = 2 * endpoint number eg. for EP2_OUT it is 4. - * - For IN endopoints = (2 * endpoint number) + 1 eg. for EP2_IN it is 5. - * \param[in] pfn Endpoint event handler function. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_API_INVALID_PARAM2 ep_index is outside the boundary ( < 2 * USBD_API_INIT_PARAM_T::max_num_ep). - * - */ - ErrorCode_t (*RegisterEpHandler)(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data); - - /** \fn void SetupStage(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in setup state. - * - * This function is called by USB stack and the application layer to - * set the EP0 state machine in setup state. This function will read - * the setup packet received from USB host into stack's buffer. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*SetupStage )(USBD_HANDLE_T hUsb); - - /** \fn void DataInStage(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in data_in state. - * - * This function is called by USB stack and the application layer to - * set the EP0 state machine in data_in state. This function will write - * the data present in EP0Data buffer to EP0 FIFO for transmission to host. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*DataInStage)(USBD_HANDLE_T hUsb); - - /** \fn void DataOutStage(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in data_out state. - * - * This function is called by USB stack and the application layer to - * set the EP0 state machine in data_out state. This function will read - * the control data (EP0 out packets) received from USB host into EP0Data buffer. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*DataOutStage)(USBD_HANDLE_T hUsb); - - /** \fn void StatusInStage(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in status_in state. - * - * This function is called by USB stack and the application layer to - * set the EP0 state machine in status_in state. This function will send - * zero length IN packet on EP0 to host, indicating positive status. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*StatusInStage)(USBD_HANDLE_T hUsb); - /** \fn void StatusOutStage(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in status_out state. - * - * This function is called by USB stack and the application layer to - * set the EP0 state machine in status_out state. This function will read - * the zero length OUT packet received from USB host on EP0. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*StatusOutStage)(USBD_HANDLE_T hUsb); - - /** \fn void StallEp0(USBD_HANDLE_T hUsb) - * Function to set EP0 state machine in stall state. - * - * This function is called by USB stack and the application layer to - * generate STALL signaling on EP0 endpoint. This function will also - * reset the EP0Data buffer. - * \n - * \note This interface is provided to users to invoke this function in other - * scenarios which are not handle by current stack. In most user applications - * this function is not called directly.Also this function can be used by - * users who are selectively modifying the USB device stack's standard handlers - * through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*StallEp0)(USBD_HANDLE_T hUsb); - -} USBD_CORE_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes - *-----------------------------------------------------------------------------*/ - - /** @cond ADVANCED_API */ - -/* forward declaration */ -struct _USB_CORE_CTRL_T; -typedef struct _USB_CORE_CTRL_T USB_CORE_CTRL_T; - -/* USB device Speed status defines */ -#define USB_FULL_SPEED 0 -#define USB_HIGH_SPEED 1 - -/* USB Endpoint Data Structure */ -typedef struct _USB_EP_DATA -{ - uint8_t *pData; - uint16_t Count; - uint16_t pad0; -} USB_EP_DATA; - - -/* USB core controller data structure */ -struct _USB_CORE_CTRL_T -{ - /* override-able function pointers ~ c++ style virtual functions*/ - USB_CB_T USB_EvtSetupHandler; - USB_CB_T USB_EvtOutHandler; - USB_PARAM_CB_T USB_ReqVendor; - USB_CB_T USB_ReqGetStatus; - USB_CB_T USB_ReqGetDescriptor; - USB_CB_T USB_ReqGetConfiguration; - USB_CB_T USB_ReqSetConfiguration; - USB_CB_T USB_ReqGetInterface; - USB_CB_T USB_ReqSetInterface; - USB_PARAM_CB_T USB_ReqSetClrFeature; - - /* USB Device Events Callback Functions */ - USB_CB_T USB_Reset_Event; - USB_CB_T USB_Suspend_Event; - USB_CB_T USB_Resume_Event; - USB_CB_T USB_SOF_Event; - USB_PARAM_CB_T USB_Power_Event; - USB_PARAM_CB_T USB_Error_Event; - USB_PARAM_CB_T USB_WakeUpCfg; - - /* USB Core Events Callback Functions */ - USB_CB_T USB_Configure_Event; - USB_CB_T USB_Interface_Event; - USB_CB_T USB_Feature_Event; - - /* cache and MMU translation functions */ - uint32_t (* virt_to_phys)(void* vaddr); - void (* cache_flush)(uint32_t* start_adr, uint32_t* end_adr); - - /* event handlers for endpoints. */ - USB_EP_HANDLER_T ep_event_hdlr[2 * USB_MAX_EP_NUM]; - void* ep_hdlr_data[2 * USB_MAX_EP_NUM]; - - /* USB class handlers */ - USB_EP_HANDLER_T ep0_hdlr_cb[USB_MAX_IF_NUM]; - void* ep0_cb_data[USB_MAX_IF_NUM]; - uint8_t num_ep0_hdlrs; - /* USB Core data Variables */ - uint8_t max_num_ep; /* max number of endpoints supported by the HW */ - uint8_t device_speed; - uint8_t num_interfaces; - uint8_t device_addr; - uint8_t config_value; - uint16_t device_status; - uint8_t *device_desc; - uint8_t *string_desc; - uint8_t *full_speed_desc; - uint8_t *high_speed_desc; - uint8_t *device_qualifier; - uint32_t ep_mask; - uint32_t ep_halt; - uint32_t ep_stall; - uint8_t alt_setting[USB_MAX_IF_NUM]; - /* HW driver data pointer */ - void* hw_data; - - /* USB Endpoint 0 Data Info */ - USB_EP_DATA EP0Data; - - /* USB Endpoint 0 Buffer */ - //ALIGNED(4) - uint8_t EP0Buf[64]; - - /* USB Setup Packet */ - //ALIGNED(4) - USB_SETUP_PACKET SetupPacket; - -}; - -/* USB Core Functions */ -extern void mwUSB_InitCore(USB_CORE_CTRL_T* pCtrl, USB_CORE_DESCS_T* pdescr, USBD_API_INIT_PARAM_T* param); -extern void mwUSB_ResetCore(USBD_HANDLE_T hUsb); - -/* inline functions */ -static INLINE void USB_SetSpeedMode(USB_CORE_CTRL_T* pCtrl, uint8_t mode) -{ - pCtrl->device_speed = mode; -} - -static INLINE bool USB_IsConfigured(USBD_HANDLE_T hUsb) -{ - USB_CORE_CTRL_T* pCtrl = (USB_CORE_CTRL_T*) hUsb; - return (bool) (pCtrl->config_value != 0); -} - -/** @cond DIRECT_API */ -/* midleware API */ -extern ErrorCode_t mwUSB_RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data); -extern ErrorCode_t mwUSB_RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data); -extern void mwUSB_SetupStage (USBD_HANDLE_T hUsb); -extern void mwUSB_DataInStage(USBD_HANDLE_T hUsb); -extern void mwUSB_DataOutStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StatusInStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StatusOutStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StallEp0(USBD_HANDLE_T hUsb); -extern ErrorCode_t mwUSB_RegisterClassHandler(USBD_HANDLE_T hUsb, USB_EP_HANDLER_T pfn, void* data); -extern ErrorCode_t mwUSB_RegisterEpHandler(USBD_HANDLE_T hUsb, uint32_t ep_index, USB_EP_HANDLER_T pfn, void* data); -extern void mwUSB_SetupStage (USBD_HANDLE_T hUsb); -extern void mwUSB_DataInStage(USBD_HANDLE_T hUsb); -extern void mwUSB_DataOutStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StatusInStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StatusOutStage(USBD_HANDLE_T hUsb); -extern void mwUSB_StallEp0(USBD_HANDLE_T hUsb); -/** @endcond */ - -/** @endcond */ - -#endif /* __MW_USBD_CORE_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_desc.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_desc.h deleted file mode 100644 index ccd0ce196..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_desc.h +++ /dev/null @@ -1,54 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_desc.h 165 2011-04-14 17:41:11Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Descriptors Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ - -#ifndef __USBDESC_H__ -#define __USBDESC_H__ - -#include "usbd.h" - -#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) -#define B3VAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF) - -#define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR)) -#define USB_CONFIGUARTION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR)) -#define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR)) -#define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR)) -#define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)) -#define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION)) - -//#define HID_DESC_SIZE (sizeof(HID_DESCRIPTOR)) -//#define HID_REPORT_DESC_SIZE (sizeof(HID_ReportDescriptor)) - -extern const uint8_t HID_ReportDescriptor[]; -extern const uint16_t HID_ReportDescSize; -extern const uint16_t HID_DescOffset; - - -#endif /* __USBDESC_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfu.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfu.h deleted file mode 100644 index f4ab88815..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfu.h +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_dfu.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* Device Firmware Upgrade (DFU) module. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __MW_USBD_DFU_H__ -#define __MW_USBD_DFU_H__ - -#include "usbd.h" - -/** \file - * \brief Device Firmware Upgrade (DFU) class descriptors. - * - * Definition of DFU class descriptors and their bit defines. - * - */ - -/** - * If USB device is only DFU capable, DFU Interface number is always 0. - * if USB device is (DFU + Other Class (Audio/Mass Storage/HID), DFU - * Interface number should also be 0 in this implementation. - */ -#define USB_DFU_IF_NUM 0x0 - -#define USB_DFU_DESCRIPTOR_TYPE 0x21 -#define USB_DFU_DESCRIPTOR_SIZE 9 -#define USB_DFU_SUBCLASS 0x01 - -/* DFU class-specific requests (Section 3, DFU Rev 1.1) */ -#define USB_REQ_DFU_DETACH 0x00 -#define USB_REQ_DFU_DNLOAD 0x01 -#define USB_REQ_DFU_UPLOAD 0x02 -#define USB_REQ_DFU_GETSTATUS 0x03 -#define USB_REQ_DFU_CLRSTATUS 0x04 -#define USB_REQ_DFU_GETSTATE 0x05 -#define USB_REQ_DFU_ABORT 0x06 - -#define DFU_STATUS_OK 0x00 -#define DFU_STATUS_errTARGET 0x01 -#define DFU_STATUS_errFILE 0x02 -#define DFU_STATUS_errWRITE 0x03 -#define DFU_STATUS_errERASE 0x04 -#define DFU_STATUS_errCHECK_ERASED 0x05 -#define DFU_STATUS_errPROG 0x06 -#define DFU_STATUS_errVERIFY 0x07 -#define DFU_STATUS_errADDRESS 0x08 -#define DFU_STATUS_errNOTDONE 0x09 -#define DFU_STATUS_errFIRMWARE 0x0a -#define DFU_STATUS_errVENDOR 0x0b -#define DFU_STATUS_errUSBR 0x0c -#define DFU_STATUS_errPOR 0x0d -#define DFU_STATUS_errUNKNOWN 0x0e -#define DFU_STATUS_errSTALLEDPKT 0x0f - -enum dfu_state { - DFU_STATE_appIDLE = 0, - DFU_STATE_appDETACH = 1, - DFU_STATE_dfuIDLE = 2, - DFU_STATE_dfuDNLOAD_SYNC = 3, - DFU_STATE_dfuDNBUSY = 4, - DFU_STATE_dfuDNLOAD_IDLE = 5, - DFU_STATE_dfuMANIFEST_SYNC = 6, - DFU_STATE_dfuMANIFEST = 7, - DFU_STATE_dfuMANIFEST_WAIT_RST= 8, - DFU_STATE_dfuUPLOAD_IDLE = 9, - DFU_STATE_dfuERROR = 10 -}; - -#define DFU_EP0_NONE 0 -#define DFU_EP0_UNHANDLED 1 -#define DFU_EP0_STALL 2 -#define DFU_EP0_ZLP 3 -#define DFU_EP0_DATA 4 - -#define USB_DFU_CAN_DOWNLOAD (1 << 0) -#define USB_DFU_CAN_UPLOAD (1 << 1) -#define USB_DFU_MANIFEST_TOL (1 << 2) -#define USB_DFU_WILL_DETACH (1 << 3) - -PRE_PACK struct POST_PACK _USB_DFU_FUNC_DESCRIPTOR { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bmAttributes; - uint16_t wDetachTimeOut; - uint16_t wTransferSize; - uint16_t bcdDFUVersion; -}; -typedef struct _USB_DFU_FUNC_DESCRIPTOR USB_DFU_FUNC_DESCRIPTOR; - -PRE_PACK struct POST_PACK _DFU_STATUS { - uint8_t bStatus; - uint8_t bwPollTimeout[3]; - uint8_t bState; - uint8_t iString; -}; -typedef struct _DFU_STATUS DFU_STATUS_T; - -#define DFU_FUNC_DESC_SIZE sizeof(USB_DFU_FUNC_DESCRIPTOR) -#define DFU_GET_STATUS_SIZE 0x6 - - -#endif /* __MW_USBD_DFU_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfuuser.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfuuser.h deleted file mode 100644 index a135cac05..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_dfuuser.h +++ /dev/null @@ -1,276 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_dfuuser.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* Device Firmware Upgrade Class Custom User Module Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ - -#ifndef __DFUUSER_H__ -#define __DFUUSER_H__ - -#include "usbd.h" -#include "usbd_dfu.h" -#include "usbd_core.h" - -/** \file - * \brief Device Firmware Upgrade (DFU) API structures and function prototypes. - * - * Definition of functions exported by ROM based DFU function driver. - * - */ - - -/** \ingroup Group_USBD - * @defgroup USBD_DFU Device Firmware Upgrade (DFU) Class Function Driver - * \section Sec_MSCModDescription Module Description - * DFU Class Function Driver module. This module contains an internal implementation of the USB DFU Class. - * User applications can use this class driver instead of implementing the DFU class manually - * via the low-level USBD_HW and USBD_Core APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB DFU Class. - */ - -/** \brief USB descriptors data structure. - * \ingroup USBD_DFU - * - * \details This module exposes functions which interact directly with USB device stack's core layer. - * The application layer uses this component when it has to implement custom class function driver or - * standard class function driver which is not part of the current USB device stack. - * The functions exposed by this interface are to register class specific EP0 handlers and corresponding - * utility functions to manipulate EP0 state machine of the stack. This interface also exposes - * function to register custom endpoint interrupt handler. - * - */ -typedef struct USBD_DFU_INIT_PARAM -{ - /* memory allocation params */ - uint32_t mem_base; /**< Base memory location from where the stack can allocate - data and buffers. \note The memory address set in this field - should be accessible by USB DMA controller. Also this value - should be aligned on 4 byte boundary. - */ - uint32_t mem_size; /**< The size of memory buffer which stack can use. - \note The \em mem_size should be greater than the size - returned by USBD_DFU_API::GetMemSize() routine.*/ - /* DFU paramas */ - uint16_t wTransferSize; /**< DFU transfer block size in number of bytes. - This value should match the value set in DFU descriptor - provided as part of the descriptor array - (\em high_speed_desc) passed to Init() through - \ref USB_CORE_DESCS_T structure. */ - - uint16_t pad; - /** Pointer to the DFU interface descriptor within the descriptor - * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T - * structure. - */ - uint8_t* intf_desc; - /* user defined functions */ - /** - * DFU Write callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a write command. For application using zero-copy buffer scheme - * this function is called for the first time with \em length parameter set to 0. - * The application code should update the buffer pointer. - * - * \param[in] block_num Destination start address. - * \param[in, out] src Pointer to a pointer to the source of data. Pointer-to-pointer - * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy - * for more details on zero-copy concept. - * \param[out] bwPollTimeout Pointer to a 3 byte buffer which the callback implementer - * should fill with the amount of minimum time, in milliseconds, - * that the host should wait before sending a subsequent - * DFU_GETSTATUS request. - * \param[in] length Number of bytes to be written. - * \return Returns DFU_STATUS_ values defined in mw_usbd_dfu.h. - * - */ - uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout); - - /** - * DFU Read callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a read command. - * - * \param[in] block_num Destination start address. - * \param[in, out] dst Pointer to a pointer to the source of data. Pointer-to-pointer - * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy - * for more details on zero-copy concept. - * \param[in] length Amount of data copied to destination buffer. - * \return Returns - * - DFU_STATUS_ values defined in mw_usbd_dfu.h to return error conditions. - * - 0 if there is no more data to be read. Stack will send EOF frame and set - * DFU state-machine to dfuIdle state. - * - length of the data copied, should be greater than or equal to 16. If the data copied - * is less than DFU \em wTransferSize the stack will send EOF frame and - * goes to dfuIdle state. - * - */ - uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length); - - /** - * DFU done callback function. - * - * This function is provided by the application software. This function gets called - * after firmware download completes. - * - * \return Nothing. - * - */ - void (*DFU_Done)(void); - - /** - * DFU detach callback function. - * - * This function is provided by the application software. This function gets called - * after USB_REQ_DFU_DETACH is received. Applications which set USB_DFU_WILL_DETACH - * bit in DFU descriptor should define this function. As part of this function - * application can call Connect() routine to disconnect and then connect back with - * host. For application which rely on WinUSB based host application should use this - * feature since USB reset can be invoked only by kernel drivers on Windows host. - * By implementing this feature host doen't have to issue reset instead the device - * has to do it automatically by disconnect and connect procedure. - * - * \param[in] hUsb Handle DFU control structure. - * \return Nothing. - * - */ - void (*DFU_Detach)(USBD_HANDLE_T hUsb); - - /** - * Optional user override-able function to replace the default DFU class handler. - * - * The application software could override the default EP0 class handler with their - * own by providing the handler function address as this data member of the parameter - * structure. Application which like the default handler should set this data member - * to zero before calling the USBD_DFU_API::Init(). - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*DFU_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - -} USBD_DFU_INIT_PARAM_T; - - -/** \brief DFU class API functions structure. - * \ingroup USBD_DFU - * - * This module exposes functions which interact directly with USB device controller hardware. - * - */ -typedef struct USBD_DFU_API -{ - /** \fn uint32_t GetMemSize(USBD_DFU_INIT_PARAM_T* param) - * Function to determine the memory required by the DFU function driver module. - * - * This function is called by application layer before calling pUsbApi->dfu->Init(), to allocate memory used - * by DFU function driver module. The application should allocate the memory which is accessible by USB - * controller/DMA controller. - * \note Some memory areas are not accessible by all bus masters. - * - * \param[in] param Structure containing DFU function driver module initialization parameters. - * \return Returns the required memory size in bytes. - */ - uint32_t (*GetMemSize)(USBD_DFU_INIT_PARAM_T* param); - - /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param) - * Function to initialize DFU function driver module. - * - * This function is called by application layer to initialize DFU function driver module. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in, out] param Structure containing DFU function driver module initialization parameters. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte aligned or smaller than required. - * \retval ERR_API_INVALID_PARAM2 Either DFU_Write() or DFU_Done() or DFU_Read() call-backs are not defined. - * \retval ERR_USBD_BAD_DESC - * - USB_DFU_DESCRIPTOR_TYPE is not defined immediately after - * interface descriptor. - * - wTransferSize in descriptor doesn't match the value passed - * in param->wTransferSize. - * - DFU_Detach() is not defined while USB_DFU_WILL_DETACH is set - * in DFU descriptor. - * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed. - */ - ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param, uint32_t init_state); - -} USBD_DFU_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes - *-----------------------------------------------------------------------------*/ -/** @cond ADVANCED_API */ - -typedef struct _USBD_DFU_CTRL_T -{ - /*ALIGNED(4)*/ DFU_STATUS_T dfu_req_get_status; - uint16_t pad; - uint8_t dfu_state; - uint8_t dfu_status; - uint8_t download_done; - uint8_t if_num; /* interface number */ - - uint8_t* xfr_buf; - USB_DFU_FUNC_DESCRIPTOR* dfu_desc; - - USB_CORE_CTRL_T* pUsbCtrl; - /* user defined functions */ - /* return DFU_STATUS_ values defined in mw_usbd_dfu.h */ - uint8_t (*DFU_Write)( uint32_t block_num, uint8_t** src, uint32_t length, uint8_t* bwPollTimeout); - /* return - * DFU_STATUS_ : values defined in mw_usbd_dfu.h in case of errors - * 0 : If end of memory reached - * length : Amount of data copied to destination buffer - */ - uint32_t (*DFU_Read)( uint32_t block_num, uint8_t** dst, uint32_t length); - /* callback called after download is finished */ - void (*DFU_Done)(void); - /* callback called after USB_REQ_DFU_DETACH is recived */ - void (*DFU_Detach)(USBD_HANDLE_T hUsb); - -} USBD_DFU_CTRL_T; - -/** @cond DIRECT_API */ -uint32_t mwDFU_GetMemSize(USBD_DFU_INIT_PARAM_T* param); -extern ErrorCode_t mwDFU_init(USBD_HANDLE_T hUsb, USBD_DFU_INIT_PARAM_T* param, uint32_t init_state); -/** @endcond */ - -/** @endcond */ - -#endif /* __DFUUSER_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hid.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hid.h deleted file mode 100644 index ae852401f..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hid.h +++ /dev/null @@ -1,437 +0,0 @@ -/*********************************************************************** -* $Id: mw_usbd_hid.h.rca 1.2 Tue Nov 1 11:45:07 2011 nlv09221 Experimental $ -* -* Project: USB device ROM Stack -* -* Description: -* HID Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __HID_H__ -#define __HID_H__ - -#include "usbd.h" - -/** \file - * \brief Common definitions and declarations for the library USB HID Class driver. - * - * Common definitions and declarations for the library USB HID Class driver. - * \addtogroup USBD_HID - * @{ - */ - - -/** HID Subclass Codes - * @{ - */ -/** Descriptor Subclass value indicating that the device or interface does not implement a HID boot protocol. */ -#define HID_SUBCLASS_NONE 0x00 -/** Descriptor Subclass value indicating that the device or interface implements a HID boot protocol. */ -#define HID_SUBCLASS_BOOT 0x01 -/** @} */ - -/** HID Protocol Codes - * @{ - */ -/** Descriptor Protocol value indicating that the device or interface does not belong to a HID boot protocol. */ -#define HID_PROTOCOL_NONE 0x00 -/** Descriptor Protocol value indicating that the device or interface belongs to the Keyboard HID boot protocol. */ -#define HID_PROTOCOL_KEYBOARD 0x01 -/** Descriptor Protocol value indicating that the device or interface belongs to the Mouse HID boot protocol. */ -#define HID_PROTOCOL_MOUSE 0x02 -/** @} */ - - - -/** Descriptor Types - * @{ - */ -/** Descriptor header type value, to indicate a HID class HID descriptor. */ -#define HID_HID_DESCRIPTOR_TYPE 0x21 -/** Descriptor header type value, to indicate a HID class HID report descriptor. */ -#define HID_REPORT_DESCRIPTOR_TYPE 0x22 -/** Descriptor header type value, to indicate a HID class HID Physical descriptor. */ -#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 -/** @} */ - - -/** \brief HID class-specific HID Descriptor. - * - * Type define for the HID class-specific HID descriptor, to describe the HID device's specifications. Refer to the HID - * specification for details on the structure elements. - * - */ -PRE_PACK struct POST_PACK _HID_DESCRIPTOR { - uint8_t bLength; /**< Size of the descriptor, in bytes. */ - uint8_t bDescriptorType; /**< Type of HID descriptor. */ - uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */ - uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */ - uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */ - - PRE_PACK struct POST_PACK _HID_DESCRIPTOR_LIST { - uint8_t bDescriptorType; /**< Type of HID report. */ - uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */ - } DescriptorList[1]; /**< Array of one or more descriptors */ -} ; -/** HID class-specific HID Descriptor. */ -typedef struct _HID_DESCRIPTOR HID_DESCRIPTOR; - -#define HID_DESC_SIZE sizeof(HID_DESCRIPTOR) - -/** HID Request Codes - * @{ - */ -#define HID_REQUEST_GET_REPORT 0x01 -#define HID_REQUEST_GET_IDLE 0x02 -#define HID_REQUEST_GET_PROTOCOL 0x03 -#define HID_REQUEST_SET_REPORT 0x09 -#define HID_REQUEST_SET_IDLE 0x0A -#define HID_REQUEST_SET_PROTOCOL 0x0B -/** @} */ - -/** HID Report Types - * @{ - */ -#define HID_REPORT_INPUT 0x01 -#define HID_REPORT_OUTPUT 0x02 -#define HID_REPORT_FEATURE 0x03 -/** @} */ - - -/** Usage Pages - * @{ - */ -#define HID_USAGE_PAGE_UNDEFINED 0x00 -#define HID_USAGE_PAGE_GENERIC 0x01 -#define HID_USAGE_PAGE_SIMULATION 0x02 -#define HID_USAGE_PAGE_VR 0x03 -#define HID_USAGE_PAGE_SPORT 0x04 -#define HID_USAGE_PAGE_GAME 0x05 -#define HID_USAGE_PAGE_DEV_CONTROLS 0x06 -#define HID_USAGE_PAGE_KEYBOARD 0x07 -#define HID_USAGE_PAGE_LED 0x08 -#define HID_USAGE_PAGE_BUTTON 0x09 -#define HID_USAGE_PAGE_ORDINAL 0x0A -#define HID_USAGE_PAGE_TELEPHONY 0x0B -#define HID_USAGE_PAGE_CONSUMER 0x0C -#define HID_USAGE_PAGE_DIGITIZER 0x0D -#define HID_USAGE_PAGE_UNICODE 0x10 -#define HID_USAGE_PAGE_ALPHANUMERIC 0x14 -/** @} */ - - -/** Generic Desktop Page (0x01) - * @{ - */ -#define HID_USAGE_GENERIC_POINTER 0x01 -#define HID_USAGE_GENERIC_MOUSE 0x02 -#define HID_USAGE_GENERIC_JOYSTICK 0x04 -#define HID_USAGE_GENERIC_GAMEPAD 0x05 -#define HID_USAGE_GENERIC_KEYBOARD 0x06 -#define HID_USAGE_GENERIC_KEYPAD 0x07 -#define HID_USAGE_GENERIC_X 0x30 -#define HID_USAGE_GENERIC_Y 0x31 -#define HID_USAGE_GENERIC_Z 0x32 -#define HID_USAGE_GENERIC_RX 0x33 -#define HID_USAGE_GENERIC_RY 0x34 -#define HID_USAGE_GENERIC_RZ 0x35 -#define HID_USAGE_GENERIC_SLIDER 0x36 -#define HID_USAGE_GENERIC_DIAL 0x37 -#define HID_USAGE_GENERIC_WHEEL 0x38 -#define HID_USAGE_GENERIC_HATSWITCH 0x39 -#define HID_USAGE_GENERIC_COUNTED_BUFFER 0x3A -#define HID_USAGE_GENERIC_BYTE_COUNT 0x3B -#define HID_USAGE_GENERIC_MOTION_WAKEUP 0x3C -#define HID_USAGE_GENERIC_VX 0x40 -#define HID_USAGE_GENERIC_VY 0x41 -#define HID_USAGE_GENERIC_VZ 0x42 -#define HID_USAGE_GENERIC_VBRX 0x43 -#define HID_USAGE_GENERIC_VBRY 0x44 -#define HID_USAGE_GENERIC_VBRZ 0x45 -#define HID_USAGE_GENERIC_VNO 0x46 -#define HID_USAGE_GENERIC_SYSTEM_CTL 0x80 -#define HID_USAGE_GENERIC_SYSCTL_POWER 0x81 -#define HID_USAGE_GENERIC_SYSCTL_SLEEP 0x82 -#define HID_USAGE_GENERIC_SYSCTL_WAKE 0x83 -#define HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU 0x84 -#define HID_USAGE_GENERIC_SYSCTL_MAIN_MENU 0x85 -#define HID_USAGE_GENERIC_SYSCTL_APP_MENU 0x86 -#define HID_USAGE_GENERIC_SYSCTL_HELP_MENU 0x87 -#define HID_USAGE_GENERIC_SYSCTL_MENU_EXIT 0x88 -#define HID_USAGE_GENERIC_SYSCTL_MENU_SELECT 0x89 -#define HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT 0x8A -#define HID_USAGE_GENERIC_SYSCTL_MENU_LEFT 0x8B -#define HID_USAGE_GENERIC_SYSCTL_MENU_UP 0x8C -#define HID_USAGE_GENERIC_SYSCTL_MENU_DOWN 0x8D -/** @} */ - -/** Simulation Controls Page (0x02) - * @{ - */ -#define HID_USAGE_SIMULATION_RUDDER 0xBA -#define HID_USAGE_SIMULATION_THROTTLE 0xBB -/** @} */ - -/* Virtual Reality Controls Page (0x03) */ -/* ... */ - -/* Sport Controls Page (0x04) */ -/* ... */ - -/* Game Controls Page (0x05) */ -/* ... */ - -/* Generic Device Controls Page (0x06) */ -/* ... */ - -/** Keyboard/Keypad Page (0x07) - * @{ - */ -/** Error "keys" */ -#define HID_USAGE_KEYBOARD_NOEVENT 0x00 -#define HID_USAGE_KEYBOARD_ROLLOVER 0x01 -#define HID_USAGE_KEYBOARD_POSTFAIL 0x02 -#define HID_USAGE_KEYBOARD_UNDEFINED 0x03 - -/** Letters */ -#define HID_USAGE_KEYBOARD_aA 0x04 -#define HID_USAGE_KEYBOARD_zZ 0x1D - -/** Numbers */ -#define HID_USAGE_KEYBOARD_ONE 0x1E -#define HID_USAGE_KEYBOARD_ZERO 0x27 - -#define HID_USAGE_KEYBOARD_RETURN 0x28 -#define HID_USAGE_KEYBOARD_ESCAPE 0x29 -#define HID_USAGE_KEYBOARD_DELETE 0x2A - -/** Funtion keys */ -#define HID_USAGE_KEYBOARD_F1 0x3A -#define HID_USAGE_KEYBOARD_F12 0x45 - -#define HID_USAGE_KEYBOARD_PRINT_SCREEN 0x46 - -/** Modifier Keys */ -#define HID_USAGE_KEYBOARD_LCTRL 0xE0 -#define HID_USAGE_KEYBOARD_LSHFT 0xE1 -#define HID_USAGE_KEYBOARD_LALT 0xE2 -#define HID_USAGE_KEYBOARD_LGUI 0xE3 -#define HID_USAGE_KEYBOARD_RCTRL 0xE4 -#define HID_USAGE_KEYBOARD_RSHFT 0xE5 -#define HID_USAGE_KEYBOARD_RALT 0xE6 -#define HID_USAGE_KEYBOARD_RGUI 0xE7 -#define HID_USAGE_KEYBOARD_SCROLL_LOCK 0x47 -#define HID_USAGE_KEYBOARD_NUM_LOCK 0x53 -#define HID_USAGE_KEYBOARD_CAPS_LOCK 0x39 -/** @} */ - -/* ... */ - -/** LED Page (0x08) - * @{ - */ -#define HID_USAGE_LED_NUM_LOCK 0x01 -#define HID_USAGE_LED_CAPS_LOCK 0x02 -#define HID_USAGE_LED_SCROLL_LOCK 0x03 -#define HID_USAGE_LED_COMPOSE 0x04 -#define HID_USAGE_LED_KANA 0x05 -#define HID_USAGE_LED_POWER 0x06 -#define HID_USAGE_LED_SHIFT 0x07 -#define HID_USAGE_LED_DO_NOT_DISTURB 0x08 -#define HID_USAGE_LED_MUTE 0x09 -#define HID_USAGE_LED_TONE_ENABLE 0x0A -#define HID_USAGE_LED_HIGH_CUT_FILTER 0x0B -#define HID_USAGE_LED_LOW_CUT_FILTER 0x0C -#define HID_USAGE_LED_EQUALIZER_ENABLE 0x0D -#define HID_USAGE_LED_SOUND_FIELD_ON 0x0E -#define HID_USAGE_LED_SURROUND_FIELD_ON 0x0F -#define HID_USAGE_LED_REPEAT 0x10 -#define HID_USAGE_LED_STEREO 0x11 -#define HID_USAGE_LED_SAMPLING_RATE_DETECT 0x12 -#define HID_USAGE_LED_SPINNING 0x13 -#define HID_USAGE_LED_CAV 0x14 -#define HID_USAGE_LED_CLV 0x15 -#define HID_USAGE_LED_RECORDING_FORMAT_DET 0x16 -#define HID_USAGE_LED_OFF_HOOK 0x17 -#define HID_USAGE_LED_RING 0x18 -#define HID_USAGE_LED_MESSAGE_WAITING 0x19 -#define HID_USAGE_LED_DATA_MODE 0x1A -#define HID_USAGE_LED_BATTERY_OPERATION 0x1B -#define HID_USAGE_LED_BATTERY_OK 0x1C -#define HID_USAGE_LED_BATTERY_LOW 0x1D -#define HID_USAGE_LED_SPEAKER 0x1E -#define HID_USAGE_LED_HEAD_SET 0x1F -#define HID_USAGE_LED_HOLD 0x20 -#define HID_USAGE_LED_MICROPHONE 0x21 -#define HID_USAGE_LED_COVERAGE 0x22 -#define HID_USAGE_LED_NIGHT_MODE 0x23 -#define HID_USAGE_LED_SEND_CALLS 0x24 -#define HID_USAGE_LED_CALL_PICKUP 0x25 -#define HID_USAGE_LED_CONFERENCE 0x26 -#define HID_USAGE_LED_STAND_BY 0x27 -#define HID_USAGE_LED_CAMERA_ON 0x28 -#define HID_USAGE_LED_CAMERA_OFF 0x29 -#define HID_USAGE_LED_ON_LINE 0x2A -#define HID_USAGE_LED_OFF_LINE 0x2B -#define HID_USAGE_LED_BUSY 0x2C -#define HID_USAGE_LED_READY 0x2D -#define HID_USAGE_LED_PAPER_OUT 0x2E -#define HID_USAGE_LED_PAPER_JAM 0x2F -#define HID_USAGE_LED_REMOTE 0x30 -#define HID_USAGE_LED_FORWARD 0x31 -#define HID_USAGE_LED_REVERSE 0x32 -#define HID_USAGE_LED_STOP 0x33 -#define HID_USAGE_LED_REWIND 0x34 -#define HID_USAGE_LED_FAST_FORWARD 0x35 -#define HID_USAGE_LED_PLAY 0x36 -#define HID_USAGE_LED_PAUSE 0x37 -#define HID_USAGE_LED_RECORD 0x38 -#define HID_USAGE_LED_ERROR 0x39 -#define HID_USAGE_LED_SELECTED_INDICATOR 0x3A -#define HID_USAGE_LED_IN_USE_INDICATOR 0x3B -#define HID_USAGE_LED_MULTI_MODE_INDICATOR 0x3C -#define HID_USAGE_LED_INDICATOR_ON 0x3D -#define HID_USAGE_LED_INDICATOR_FLASH 0x3E -#define HID_USAGE_LED_INDICATOR_SLOW_BLINK 0x3F -#define HID_USAGE_LED_INDICATOR_FAST_BLINK 0x40 -#define HID_USAGE_LED_INDICATOR_OFF 0x41 -#define HID_USAGE_LED_FLASH_ON_TIME 0x42 -#define HID_USAGE_LED_SLOW_BLINK_ON_TIME 0x43 -#define HID_USAGE_LED_SLOW_BLINK_OFF_TIME 0x44 -#define HID_USAGE_LED_FAST_BLINK_ON_TIME 0x45 -#define HID_USAGE_LED_FAST_BLINK_OFF_TIME 0x46 -#define HID_USAGE_LED_INDICATOR_COLOR 0x47 -#define HID_USAGE_LED_RED 0x48 -#define HID_USAGE_LED_GREEN 0x49 -#define HID_USAGE_LED_AMBER 0x4A -#define HID_USAGE_LED_GENERIC_INDICATOR 0x4B -/** @} */ - -/* Button Page (0x09) - */ -/* There is no need to label these usages. */ - -/* Ordinal Page (0x0A) - */ -/* There is no need to label these usages. */ - -/** Telephony Device Page (0x0B) - * @{ - */ -#define HID_USAGE_TELEPHONY_PHONE 0x01 -#define HID_USAGE_TELEPHONY_ANSWERING_MACHINE 0x02 -#define HID_USAGE_TELEPHONY_MESSAGE_CONTROLS 0x03 -#define HID_USAGE_TELEPHONY_HANDSET 0x04 -#define HID_USAGE_TELEPHONY_HEADSET 0x05 -#define HID_USAGE_TELEPHONY_KEYPAD 0x06 -#define HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON 0x07 -/** @} */ -/* ... */ - -/** Consumer Page (0x0C) - * @{ - */ -#define HID_USAGE_CONSUMER_CONTROL 0x01 -#define HID_USAGE_CONSUMER_FAST_FORWARD 0xB3 -#define HID_USAGE_CONSUMER_REWIND 0xB4 -#define HID_USAGE_CONSUMER_PLAY_PAUSE 0xCD -#define HID_USAGE_CONSUMER_VOLUME_INCREMENT 0xE9 -#define HID_USAGE_CONSUMER_VOLUME_DECREMENT 0xEA -/** @} */ -/* ... */ - -/* and others ... */ - - -/** HID Report Item Macros - * @{ - */ -/** Main Items */ -#define HID_Input(x) 0x81,x -#define HID_Output(x) 0x91,x -#define HID_Feature(x) 0xB1,x -#define HID_Collection(x) 0xA1,x -#define HID_EndCollection 0xC0 - -/** Data (Input, Output, Feature) */ -#define HID_Data 0<<0 -#define HID_Constant 1<<0 -#define HID_Array 0<<1 -#define HID_Variable 1<<1 -#define HID_Absolute 0<<2 -#define HID_Relative 1<<2 -#define HID_NoWrap 0<<3 -#define HID_Wrap 1<<3 -#define HID_Linear 0<<4 -#define HID_NonLinear 1<<4 -#define HID_PreferredState 0<<5 -#define HID_NoPreferred 1<<5 -#define HID_NoNullPosition 0<<6 -#define HID_NullState 1<<6 -#define HID_NonVolatile 0<<7 -#define HID_Volatile 1<<7 - -/** Collection Data */ -#define HID_Physical 0x00 -#define HID_Application 0x01 -#define HID_Logical 0x02 -#define HID_Report 0x03 -#define HID_NamedArray 0x04 -#define HID_UsageSwitch 0x05 -#define HID_UsageModifier 0x06 - -/** Global Items */ -#define HID_UsagePage(x) 0x05,x -#define HID_UsagePageVendor(x) 0x06,x,0xFF -#define HID_LogicalMin(x) 0x15,x -#define HID_LogicalMinS(x) 0x16,(x&0xFF),((x>>8)&0xFF) -#define HID_LogicalMinL(x) 0x17,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF) -#define HID_LogicalMax(x) 0x25,x -#define HID_LogicalMaxS(x) 0x26,(x&0xFF),((x>>8)&0xFF) -#define HID_LogicalMaxL(x) 0x27,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF) -#define HID_PhysicalMin(x) 0x35,x -#define HID_PhysicalMinS(x) 0x36,(x&0xFF),((x>>8)&0xFF) -#define HID_PhysicalMinL(x) 0x37,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF) -#define HID_PhysicalMax(x) 0x45,x -#define HID_PhysicalMaxS(x) 0x46,(x&0xFF),((x>>8)&0xFF) -#define HID_PhysicalMaxL(x) 0x47,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF) -#define HID_UnitExponent(x) 0x55,x -#define HID_Unit(x) 0x65,x -#define HID_UnitS(x) 0x66,(x&0xFF),((x>>8)&0xFF) -#define HID_UnitL(x) 0x67,(x&0xFF),((x>>8)&0xFF),((x>>16)&0xFF),((x>>24)&0xFF) -#define HID_ReportSize(x) 0x75,x -#define HID_ReportID(x) 0x85,x -#define HID_ReportCount(x) 0x95,x -#define HID_ReportCount16(x) 0x96,(x&0xFF),((x>>8)&0xFF) -#define HID_Push 0xA0 -#define HID_Pop 0xB0 - -/** Local Items */ -#define HID_Usage(x) 0x09,x -#define HID_UsageMin(x) 0x19,x -#define HID_UsageMax(x) 0x29,x -/** @} */ - -/** @} */ - -#endif /* __HID_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hiduser.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hiduser.h deleted file mode 100644 index 9b9a6f0e0..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hiduser.h +++ /dev/null @@ -1,427 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_hiduser.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* HID Custom User Module Definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ - -#ifndef __HIDUSER_H__ -#define __HIDUSER_H__ - -#include "usbd.h" -#include "usbd_hid.h" -#include "usbd_core.h" - -/** \file - * \brief Human Interface Device (HID) API structures and function prototypes. - * - * Definition of functions exported by ROM based HID function driver. - * - */ - -/** \ingroup Group_USBD - * @defgroup USBD_HID HID Class Function Driver - * \section Sec_HIDModDescription Module Description - * HID Class Function Driver module. This module contains an internal implementation of the USB HID Class. - * User applications can use this class driver instead of implementing the HID class manually - * via the low-level HW and core APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB HID Class. - */ - -/** \brief HID report descriptor data structure. - * \ingroup USBD_HID - * - * \details This structure is used as part of HID function driver initialization - * parameter structure \ref USBD_HID_INIT_PARAM. This structure contains - * details of a report type supported by the application. An application - * can support multiple report types as a single HID device. The application - * should define this report type data structure per report it supports and - * the array of report types to USBD_HID_API::init() through \ref USBD_HID_INIT_PARAM - * structure. - * - * \note All descriptor pointers assigned in this structure should be on 4 byte - * aligned address boundary. - * - */ -typedef struct _HID_REPORT_T { - uint16_t len; /**< Size of the report descriptor in bytes. */ - uint8_t idle_time; /**< This value is used by stack to respond to Set_Idle & - GET_Idle requests for the specified report ID. The value - of this field specified the rate at which duplicate reports - are generated for the specified Report ID. For example, a - device with two input reports could specify an idle rate of - 20 milliseconds for report ID 1 and 500 milliseconds for - report ID 2. - */ - uint8_t __pad; /**< Padding space. */ - uint8_t* desc; /**< Report descriptor. */ -} USB_HID_REPORT_T; - -/** \brief USB descriptors data structure. - * \ingroup USBD_HID - * - * \details This module exposes functions which interact directly with USB device stack's core layer. - * The application layer uses this component when it has to implement custom class function driver or - * standard class function driver which is not part of the current USB device stack. - * The functions exposed by this interface are to register class specific EP0 handlers and corresponding - * utility functions to manipulate EP0 state machine of the stack. This interface also exposes - * function to register custom endpoint interrupt handler. - * - */ -typedef struct USBD_HID_INIT_PARAM -{ - /* memory allocation params */ - uint32_t mem_base; /**< Base memory location from where the stack can allocate - data and buffers. \note The memory address set in this field - should be accessible by USB DMA controller. Also this value - should be aligned on 4 byte boundary. - */ - uint32_t mem_size; /**< The size of memory buffer which stack can use. - \note The \em mem_size should be greater than the size - returned by USBD_HID_API::GetMemSize() routine.*/ - /* HID paramas */ - uint8_t max_reports; /**< Number of HID reports supported by this instance - of HID class driver. - */ - uint8_t pad[3]; - uint8_t* intf_desc; /**< Pointer to the HID interface descriptor within the - descriptor array (\em high_speed_desc) passed to Init() - through \ref USB_CORE_DESCS_T structure. - */ - USB_HID_REPORT_T* report_data; /**< Pointer to an array of HID report descriptor - data structure (\ref USB_HID_REPORT_T). The number - of elements in the array should be same a \em max_reports - value. The stack uses this array to respond to - requests received for various HID report descriptor - information. \note This array should be of global scope. - */ - - /* user defined functions */ - /* required functions */ - /** - * HID get report callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a HID_REQUEST_GET_REPORT request. The setup packet data (\em pSetup) - * is passed to the callback so that application can extract the report ID, report - * type and other information need to generate the report. \note HID reports are sent - * via interrupt IN endpoint also. This function is called only when report request - * is received on control endpoint. Application should implement \em HID_EpIn_Hdlr to - * send reports to host via interrupt IN endpoint. - * - * - * \param[in] hHid Handle to HID function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in, out] pBuffer Pointer to a pointer of data buffer containing report data. - * Pointer-to-pointer is used to implement zero-copy buffers. - * See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in] length Amount of data copied to destination buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length); - - /** - * HID set report callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a HID_REQUEST_SET_REPORT request. The setup packet data (\em pSetup) - * is passed to the callback so that application can extract the report ID, report - * type and other information need to modify the report. An application might choose - * to ignore input Set_Report requests as meaningless. Alternatively these reports - * could be used to reset the origin of a control (that is, current position should - * report zero). - * - * \param[in] hHid Handle to HID function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in, out] pBuffer Pointer to a pointer of data buffer containing report data. - * Pointer-to-pointer is used to implement zero-copy buffers. - * See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in] length Amount of data copied to destination buffer. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length); - - /* optional functions */ - - /** - * Optional callback function to handle HID_GetPhysDesc request. - * - * The application software could provide this callback HID_GetPhysDesc handler to - * handle get physical descriptor requests sent by the host. When host requests - * Physical Descriptor set 0, application should return a special descriptor - * identifying the number of descriptor sets and their sizes. A Get_Descriptor - * request with the Physical Index equal to 1 should return the first Physical - * Descriptor set. A device could possibly have alternate uses for its items. - * These can be enumerated by issuing subsequent Get_Descriptor requests while - * incrementing the Descriptor Index. A device should return the last descriptor - * set to requests with an index greater than the last number defined in the HID - * descriptor. - * \note Applications which don't have physical descriptor should set this data member - * to zero before calling the USBD_HID_API::Init(). - * \n - * - * \param[in] hHid Handle to HID function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in] pBuf Pointer to a pointer of data buffer containing physical descriptor - * data. If the physical descriptor is in USB accessible memory area - * application could just update the pointer or else it should copy - * the descriptor to the address pointed by this pointer. - * \param[in] length Amount of data copied to destination buffer or descriptor length. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length); - - /** - * Optional callback function to handle HID_REQUEST_SET_IDLE request. - * - * The application software could provide this callback to handle HID_REQUEST_SET_IDLE - * requests sent by the host. This callback is provided to applications to adjust - * timers associated with various reports, which are sent to host over interrupt - * endpoint. The setup packet data (\em pSetup) is passed to the callback so that - * application can extract the report ID, report type and other information need - * to modify the report's idle time. - * \note Applications which don't send reports on Interrupt endpoint or don't - * have idle time between reports should set this data member to zero before - * calling the USBD_HID_API::Init(). - * \n - * - * \param[in] hHid Handle to HID function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in] idleTime Idle time to be set for the specified report. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime); - - /** - * Optional callback function to handle HID_REQUEST_SET_PROTOCOL request. - * - * The application software could provide this callback to handle HID_REQUEST_SET_PROTOCOL - * requests sent by the host. This callback is provided to applications to adjust - * modes of their code between boot mode and report mode. - * \note Applications which don't support protocol modes should set this data member - * to zero before calling the USBD_HID_API::Init(). - * \n - * - * \param[in] hHid Handle to HID function driver. - * \param[in] pSetup Pointer to setup packet received from host. - * \param[in] protocol Protocol mode. - * 0 = Boot Protocol - * 1 = Report Protocol - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol); - - /** - * Optional Interrupt IN endpoint event handler. - * - * The application software could provide Interrupt IN endpoint event handler. - * Application which send reports to host on interrupt endpoint should provide - * an endpoint event handler through this data member. This data member is - * ignored if the interface descriptor \em intf_desc doesn't have any IN interrupt - * endpoint descriptor associated. - * \n - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Handle to HID function driver. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should return \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_EpIn_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - /** - * Optional Interrupt OUT endpoint event handler. - * - * The application software could provide Interrupt OUT endpoint event handler. - * Application which receives reports from host on interrupt endpoint should provide - * an endpoint event handler through this data member. This data member is - * ignored if the interface descriptor \em intf_desc doesn't have any OUT interrupt - * endpoint descriptor associated. - * \n - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Handle to HID function driver. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should return \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_EpOut_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - - /* user override-able function */ - /** - * Optional user override-able function to replace the default HID_GetReportDesc handler. - * - * The application software could override the default HID_GetReportDesc handler with their - * own by providing the handler function address as this data member of the parameter - * structure. Application which like the default handler should set this data member - * to zero before calling the USBD_HID_API::Init() and also provide report data array - * \em report_data field. - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length); - /** - * Optional user override-able function to replace the default HID class handler. - * - * The application software could override the default EP0 class handler with their - * own by providing the handler function address as this data member of the parameter - * structure. Application which like the default handler should set this data member - * to zero before calling the USBD_HID_API::Init(). - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*HID_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - -} USBD_HID_INIT_PARAM_T; - -/** \brief HID class API functions structure. - * \ingroup USBD_HID - * - * This structure contains pointers to all the function exposed by HID function driver module. - * - */ -typedef struct USBD_HID_API -{ - /** \fn uint32_t GetMemSize(USBD_HID_INIT_PARAM_T* param) - * Function to determine the memory required by the HID function driver module. - * - * This function is called by application layer before calling pUsbApi->hid->Init(), to allocate memory used - * by HID function driver module. The application should allocate the memory which is accessible by USB - * controller/DMA controller. - * \note Some memory areas are not accessible by all bus masters. - * - * \param[in] param Structure containing HID function driver module initialization parameters. - * \return Returns the required memory size in bytes. - */ - uint32_t (*GetMemSize)(USBD_HID_INIT_PARAM_T* param); - - /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param) - * Function to initialize HID function driver module. - * - * This function is called by application layer to initialize HID function driver - * module. On successful initialization the function returns a handle to HID - * function driver module in passed param structure. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in, out] param Structure containing HID function driver module - * initialization parameters. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte - * aligned or smaller than required. - * \retval ERR_API_INVALID_PARAM2 Either HID_GetReport() or HID_SetReport() - * callback are not defined. - * \retval ERR_USBD_BAD_DESC HID_HID_DESCRIPTOR_TYPE is not defined - * immediately after interface descriptor. - * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed. - * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed. - */ - ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param); - -} USBD_HID_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes - *-----------------------------------------------------------------------------*/ -/** @cond ADVANCED_API */ - -typedef struct _HID_CTRL_T { - /* pointer to controller */ - USB_CORE_CTRL_T* pUsbCtrl; - /* descriptor pointers */ - uint8_t* hid_desc; - USB_HID_REPORT_T* report_data; - - uint8_t protocol; - uint8_t if_num; /* interface number */ - uint8_t epin_adr; /* IN interrupt endpoint */ - uint8_t epout_adr; /* OUT interrupt endpoint */ - - /* user defined functions */ - ErrorCode_t (*HID_GetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t* length); - ErrorCode_t (*HID_SetReport)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuffer, uint16_t length); - ErrorCode_t (*HID_GetPhysDesc)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length); - ErrorCode_t (*HID_SetIdle)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t idleTime); - ErrorCode_t (*HID_SetProtocol)( USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t protocol); - - /* virtual overridable functions */ - ErrorCode_t (*HID_GetReportDesc)(USBD_HANDLE_T hHid, USB_SETUP_PACKET* pSetup, uint8_t** pBuf, uint16_t* length); - -}USB_HID_CTRL_T; - -/** @cond DIRECT_API */ -extern uint32_t mwHID_GetMemSize(USBD_HID_INIT_PARAM_T* param); -extern ErrorCode_t mwHID_init(USBD_HANDLE_T hUsb, USBD_HID_INIT_PARAM_T* param); -/** @endcond */ - -/** @endcond */ - -#endif /* __HIDUSER_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hw.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hw.h deleted file mode 100644 index 8dc98ff38..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_hw.h +++ /dev/null @@ -1,463 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_hw.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* USB Hardware Function prototypes. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __USBHW_H__ -#define __USBHW_H__ - -#include "error.h" -#include "usbd.h" -#include "usbd_core.h" - -/** \file - * \brief USB Hardware Function prototypes. - * - * Definition of functions exported by ROM based Device Controller Driver (DCD). - * - */ - -/** \ingroup Group_USBD - * @defgroup USBD_HW USB Device Controller Driver - * \section Sec_HWModDescription Module Description - * The Device Controller Driver Layer implements the routines to deal directly with the hardware. - */ - -/** \ingroup USBD_HW -* USB Endpoint/class handler Callback Events. -* -*/ -enum USBD_EVENT_T { - USB_EVT_SETUP =1, /**< 1 Setup Packet received */ - USB_EVT_OUT, /**< 2 OUT Packet received */ - USB_EVT_IN, /**< 3 IN Packet sent */ - USB_EVT_OUT_NAK, /**< 4 OUT Packet - Not Acknowledged */ - USB_EVT_IN_NAK, /**< 5 IN Packet - Not Acknowledged */ - USB_EVT_OUT_STALL, /**< 6 OUT Packet - Stalled */ - USB_EVT_IN_STALL, /**< 7 IN Packet - Stalled */ - USB_EVT_OUT_DMA_EOT, /**< 8 DMA OUT EP - End of Transfer */ - USB_EVT_IN_DMA_EOT, /**< 9 DMA IN EP - End of Transfer */ - USB_EVT_OUT_DMA_NDR, /**< 10 DMA OUT EP - New Descriptor Request */ - USB_EVT_IN_DMA_NDR, /**< 11 DMA IN EP - New Descriptor Request */ - USB_EVT_OUT_DMA_ERR, /**< 12 DMA OUT EP - Error */ - USB_EVT_IN_DMA_ERR, /**< 13 DMA IN EP - Error */ - USB_EVT_RESET, /**< 14 Reset event recieved */ - USB_EVT_SOF, /**< 15 Start of Frame event */ - USB_EVT_DEV_STATE, /**< 16 Device status events */ - USB_EVT_DEV_ERROR /**< 17 Device error events */ -}; - -/** - * \brief Hardware API functions structure. - * \ingroup USBD_HW - * - * This module exposes functions which interact directly with USB device controller hardware. - * - */ -typedef struct USBD_HW_API -{ - /** \fn uint32_t GetMemSize(USBD_API_INIT_PARAM_T* param) - * Function to determine the memory required by the USB device stack's DCD and core layers. - * - * This function is called by application layer before calling pUsbApi->hw->Init(), to allocate memory used - * by DCD and core layers. The application should allocate the memory which is accessible by USB - * controller/DMA controller. - * \note Some memory areas are not accessible by all bus masters. - * - * \param[in] param Structure containing USB device stack initialization parameters. - * \return Returns the required memory size in bytes. - */ - uint32_t (*GetMemSize)(USBD_API_INIT_PARAM_T* param); - - /** \fn ErrorCode_t Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param) - * Function to initialize USB device stack's DCD and core layers. - * - * This function is called by application layer to initialize USB hardware and core layers. - * On successful initialization the function returns a handle to USB device stack which should - * be passed to the rest of the functions. - * - * \param[in,out] phUsb Pointer to the USB device stack handle of type USBD_HANDLE_T. - * \param[in] pDesc Structure containing pointers to various descriptor arrays needed by the stack. - * These descriptors are reported to USB host as part of enumerations process. - * \param[in] param Structure containing USB device stack initialization parameters. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK(0) On success - * \retval ERR_USBD_BAD_MEM_BUF(0x0004000b) When insufficient memory buffer is passed or memory - * is not aligned on 2048 boundary. - */ - ErrorCode_t (*Init)(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param); - - /** \fn void Connect(USBD_HANDLE_T hUsb, uint32_t con) - * Function to make USB device visible/invisible on the USB bus. - * - * This function is called after the USB initialization. This function uses the soft connect - * feature to make the device visible on the USB bus. This function is called only after the - * application is ready to handle the USB data. The enumeration process is started by the - * host after the device detection. The driver handles the enumeration process according to - * the USB descriptors passed in the USB initialization function. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] con States whether to connect (1) or to disconnect (0). - * \return Nothing. - */ - void (*Connect)(USBD_HANDLE_T hUsb, uint32_t con); - - /** \fn void ISR(USBD_HANDLE_T hUsb) - * Function to USB device controller interrupt events. - * - * When the user application is active the interrupt handlers are mapped in the user flash - * space. The user application must provide an interrupt handler for the USB interrupt and - * call this function in the interrupt handler routine. The driver interrupt handler takes - * appropriate action according to the data received on the USB bus. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*ISR)(USBD_HANDLE_T hUsb); - - /** \fn void Reset(USBD_HANDLE_T hUsb) - * Function to Reset USB device stack and hardware controller. - * - * Reset USB device stack and hardware controller. Disables all endpoints except EP0. - * Clears all pending interrupts and resets endpoint transfer queues. - * This function is called internally by pUsbApi->hw->init() and from reset event. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*Reset)(USBD_HANDLE_T hUsb); - - /** \fn void ForceFullSpeed(USBD_HANDLE_T hUsb, uint32_t cfg) - * Function to force high speed USB device to operate in full speed mode. - * - * This function is useful for testing the behavior of current device when connected - * to a full speed only hosts. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] cfg When 1 - set force full-speed or - * 0 - clear force full-speed. - * \return Nothing. - */ - void (*ForceFullSpeed )(USBD_HANDLE_T hUsb, uint32_t cfg); - - /** \fn void WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg) - * Function to configure USB device controller to wake-up host on remote events. - * - * This function is called by application layer to configure the USB device controller - * to wakeup on remote events. It is recommended to call this function from users's - * USB_WakeUpCfg() callback routine registered with stack. - * \note User's USB_WakeUpCfg() is registered with stack by setting the USB_WakeUpCfg member - * of USBD_API_INIT_PARAM_T structure before calling pUsbApi->hw->Init() routine. - * Certain USB device controllers needed to keep some clocks always on to generate - * resume signaling through pUsbApi->hw->WakeUp(). This hook is provided to support - * such controllers. In most controllers cases this is an empty routine. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] cfg When 1 - Configure controller to wake on remote events or - * 0 - Configure controller not to wake on remote events. - * \return Nothing. - */ - void (*WakeUpCfg)(USBD_HANDLE_T hUsb, uint32_t cfg); - - /** \fn void SetAddress(USBD_HANDLE_T hUsb, uint32_t adr) - * Function to set USB address assigned by host in device controller hardware. - * - * This function is called automatically when USB_REQUEST_SET_ADDRESS request is received - * by the stack from USB host. - * This interface is provided to users to invoke this function in other scenarios which are not - * handle by current stack. In most user applications this function is not called directly. - * Also this function can be used by users who are selectively modifying the USB device stack's - * standard handlers through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] adr USB bus Address to which the device controller should respond. Usually - * assigned by the USB host. - * \return Nothing. - */ - void (*SetAddress)(USBD_HANDLE_T hUsb, uint32_t adr); - - /** \fn void Configure(USBD_HANDLE_T hUsb, uint32_t cfg) - * Function to configure device controller hardware with selected configuration. - * - * This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received - * by the stack from USB host. - * This interface is provided to users to invoke this function in other scenarios which are not - * handle by current stack. In most user applications this function is not called directly. - * Also this function can be used by users who are selectively modifying the USB device stack's - * standard handlers through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] cfg Configuration index. - * \return Nothing. - */ - void (*Configure)(USBD_HANDLE_T hUsb, uint32_t cfg); - - /** \fn void ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD) - * Function to configure USB Endpoint according to descriptor. - * - * This function is called automatically when USB_REQUEST_SET_CONFIGURATION request is received - * by the stack from USB host. All the endpoints associated with the selected configuration - * are configured. - * This interface is provided to users to invoke this function in other scenarios which are not - * handle by current stack. In most user applications this function is not called directly. - * Also this function can be used by users who are selectively modifying the USB device stack's - * standard handlers through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] pEPD Endpoint descriptor structure defined in USB 2.0 specification. - * \return Nothing. - */ - void (*ConfigEP)(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD); - - /** \fn void DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir) - * Function to set direction for USB control endpoint EP0. - * - * This function is called automatically by the stack on need basis. - * This interface is provided to users to invoke this function in other scenarios which are not - * handle by current stack. In most user applications this function is not called directly. - * Also this function can be used by users who are selectively modifying the USB device stack's - * standard handlers through callback interface exposed by the stack. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] cfg When 1 - Set EP0 in IN transfer mode - * 0 - Set EP0 in OUT transfer mode - * \return Nothing. - */ - void (*DirCtrlEP)(USBD_HANDLE_T hUsb, uint32_t dir); - - /** \fn void EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum) - * Function to enable selected USB endpoint. - * - * This function enables interrupts on selected endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \return Nothing. - */ - void (*EnableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum); - - /** \fn void DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum) - * Function to disable selected USB endpoint. - * - * This function disables interrupts on selected endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \return Nothing. - */ - void (*DisableEP)(USBD_HANDLE_T hUsb, uint32_t EPNum); - - /** \fn void ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum) - * Function to reset selected USB endpoint. - * - * This function flushes the endpoint buffers and resets data toggle logic. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \return Nothing. - */ - void (*ResetEP)(USBD_HANDLE_T hUsb, uint32_t EPNum); - - /** \fn void SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum) - * Function to STALL selected USB endpoint. - * - * Generates STALL signaling for requested endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \return Nothing. - */ - void (*SetStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum); - - /** \fn void ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum) - * Function to clear STALL state for the requested endpoint. - * - * This function clears STALL state for the requested endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \return Nothing. - */ - void (*ClrStallEP)(USBD_HANDLE_T hUsb, uint32_t EPNum); - - /** \fn ErrorCode_t SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode) - * Function to set high speed USB device controller in requested test mode. - * - * USB-IF requires the high speed device to be put in various test modes - * for electrical testing. This USB device stack calls this function whenever - * it receives USB_REQUEST_CLEAR_FEATURE request for USB_FEATURE_TEST_MODE. - * Users can put the device in test mode by directly calling this function. - * Returns ERR_USBD_INVALID_REQ when device controller is full-speed only. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] mode Test mode defined in USB 2.0 electrical testing specification. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK(0) - On success - * \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid test mode or - * Device controller is full-speed only. - */ - ErrorCode_t (*SetTestMode)(USBD_HANDLE_T hUsb, uint8_t mode); - - /** \fn uint32_t ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData) - * Function to read data received on the requested endpoint. - * - * This function is called by USB stack and the application layer to read the data - * received on the requested endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \param[in,out] pData Pointer to the data buffer where data is to be copied. - * \return Returns the number of bytes copied to the buffer. - */ - uint32_t (*ReadEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData); - - /** \fn uint32_t ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len) - * Function to queue read request on the specified endpoint. - * - * This function is called by USB stack and the application layer to queue a read request - * on the specified endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \param[in,out] pData Pointer to the data buffer where data is to be copied. This buffer - * address should be accessible by USB DMA master. - * \param[in] len Length of the buffer passed. - * \return Returns the length of the requested buffer. - */ - uint32_t (*ReadReqEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len); - - /** \fn uint32_t ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData) - * Function to read setup packet data received on the requested endpoint. - * - * This function is called by USB stack and the application layer to read setup packet data - * received on the requested endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP0_IN is represented by 0x80 number. - * \param[in,out] pData Pointer to the data buffer where data is to be copied. - * \return Returns the number of bytes copied to the buffer. - */ - uint32_t (*ReadSetupPkt)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t *pData); - - /** \fn uint32_t WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt) - * Function to write data to be sent on the requested endpoint. - * - * This function is called by USB stack and the application layer to send data - * on the requested endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number as per USB specification. - * ie. An EP1_IN is represented by 0x81 number. - * \param[in] pData Pointer to the data buffer from where data is to be copied. - * \param[in] cnt Number of bytes to write. - * \return Returns the number of bytes written. - */ - uint32_t (*WriteEP)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt); - - /** \fn void WakeUp(USBD_HANDLE_T hUsb) - * Function to generate resume signaling on bus for remote host wakeup. - * - * This function is called by application layer to remotely wakeup host controller - * when system is in suspend state. Application should indicate this remote wakeup - * capability by setting USB_CONFIG_REMOTE_WAKEUP in bmAttributes of Configuration - * Descriptor. Also this routine will generate resume signalling only if host - * enables USB_FEATURE_REMOTE_WAKEUP by sending SET_FEATURE request before suspending - * the bus. - * - * \param[in] hUsb Handle to the USB device stack. - * \return Nothing. - */ - void (*WakeUp)(USBD_HANDLE_T hUsb); - - /** \fn void EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable) - * Function to enable/disable selected USB event. - * - * This function enables interrupts on selected endpoint. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] EPNum Endpoint number corresponding to the event. - * ie. An EP1_IN is represented by 0x81 number. For device events - * set this param to 0x0. - * \param[in] event_type Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \param[in] enable 1 - enable event, 0 - disable event. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK(0) - On success - * \retval ERR_USBD_INVALID_REQ(0x00040001) - Invalid event type. - */ - ErrorCode_t (*EnableEvent)(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable); - -} USBD_HW_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes used by stack internally - *-----------------------------------------------------------------------------*/ -/** @cond DIRECT_API */ - -/* Driver functions */ -uint32_t hwUSB_GetMemSize(USBD_API_INIT_PARAM_T* param); -ErrorCode_t hwUSB_Init(USBD_HANDLE_T* phUsb, USB_CORE_DESCS_T* pDesc, USBD_API_INIT_PARAM_T* param); -void hwUSB_Connect(USBD_HANDLE_T hUsb, uint32_t con); -void hwUSB_ISR(USBD_HANDLE_T hUsb); - -/* USB Hardware Functions */ -extern void hwUSB_Reset(USBD_HANDLE_T hUsb); -extern void hwUSB_ForceFullSpeed (USBD_HANDLE_T hUsb, uint32_t con); -extern void hwUSB_WakeUpCfg(USBD_HANDLE_T hUsb, uint32_t cfg); -extern void hwUSB_SetAddress(USBD_HANDLE_T hUsb, uint32_t adr); -extern void hwUSB_Configure(USBD_HANDLE_T hUsb, uint32_t cfg); -extern void hwUSB_ConfigEP(USBD_HANDLE_T hUsb, USB_ENDPOINT_DESCRIPTOR *pEPD); -extern void hwUSB_DirCtrlEP(USBD_HANDLE_T hUsb, uint32_t dir); -extern void hwUSB_EnableEP(USBD_HANDLE_T hUsb, uint32_t EPNum); -extern void hwUSB_DisableEP(USBD_HANDLE_T hUsb, uint32_t EPNum); -extern void hwUSB_ResetEP(USBD_HANDLE_T hUsb, uint32_t EPNum); -extern void hwUSB_SetStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum); -extern void hwUSB_ClrStallEP(USBD_HANDLE_T hUsb, uint32_t EPNum); -extern ErrorCode_t hwUSB_SetTestMode(USBD_HANDLE_T hUsb, uint8_t mode); /* for FS only devices return ERR_USBD_INVALID_REQ */ -extern uint32_t hwUSB_ReadEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData); -extern uint32_t hwUSB_ReadReqEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t len); -extern uint32_t hwUSB_ReadSetupPkt(USBD_HANDLE_T hUsb, uint32_t, uint32_t *); -extern uint32_t hwUSB_WriteEP(USBD_HANDLE_T hUsb, uint32_t EPNum, uint8_t *pData, uint32_t cnt); - -/* generate resume signaling on the bus */ -extern void hwUSB_WakeUp(USBD_HANDLE_T hUsb); -extern ErrorCode_t hwUSB_EnableEvent(USBD_HANDLE_T hUsb, uint32_t EPNum, uint32_t event_type, uint32_t enable); -/* TODO implement following routines -- function to program TD and queue them to ep Qh -*/ - -/** @endcond */ - - -#endif /* __USBHW_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_msc.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_msc.h deleted file mode 100644 index 9b0dcb6d1..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_msc.h +++ /dev/null @@ -1,125 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_msc.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* Mass Storage Class definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ - -#ifndef __MSC_H__ -#define __MSC_H__ - -#include "usbd.h" - -/** \file - * \brief Mass Storage class (MSC) descriptors. - * - * Definition of MSC class descriptors and their bit defines. - * - */ - -/* MSC Subclass Codes */ -#define MSC_SUBCLASS_RBC 0x01 -#define MSC_SUBCLASS_SFF8020I_MMC2 0x02 -#define MSC_SUBCLASS_QIC157 0x03 -#define MSC_SUBCLASS_UFI 0x04 -#define MSC_SUBCLASS_SFF8070I 0x05 -#define MSC_SUBCLASS_SCSI 0x06 - -/* MSC Protocol Codes */ -#define MSC_PROTOCOL_CBI_INT 0x00 -#define MSC_PROTOCOL_CBI_NOINT 0x01 -#define MSC_PROTOCOL_BULK_ONLY 0x50 - - -/* MSC Request Codes */ -#define MSC_REQUEST_RESET 0xFF -#define MSC_REQUEST_GET_MAX_LUN 0xFE - - -/* MSC Bulk-only Stage */ -#define MSC_BS_CBW 0 /* Command Block Wrapper */ -#define MSC_BS_DATA_OUT 1 /* Data Out Phase */ -#define MSC_BS_DATA_IN 2 /* Data In Phase */ -#define MSC_BS_DATA_IN_LAST 3 /* Data In Last Phase */ -#define MSC_BS_DATA_IN_LAST_STALL 4 /* Data In Last Phase with Stall */ -#define MSC_BS_CSW 5 /* Command Status Wrapper */ -#define MSC_BS_ERROR 6 /* Error */ - - -/* Bulk-only Command Block Wrapper */ -PRE_PACK struct POST_PACK _MSC_CBW -{ - uint32_t dSignature; - uint32_t dTag; - uint32_t dDataLength; - uint8_t bmFlags; - uint8_t bLUN; - uint8_t bCBLength; - uint8_t CB[16]; -} ; -typedef struct _MSC_CBW MSC_CBW; - -/* Bulk-only Command Status Wrapper */ -PRE_PACK struct POST_PACK _MSC_CSW -{ - uint32_t dSignature; - uint32_t dTag; - uint32_t dDataResidue; - uint8_t bStatus; -} ; -typedef struct _MSC_CSW MSC_CSW; - -#define MSC_CBW_Signature 0x43425355 -#define MSC_CSW_Signature 0x53425355 - - -/* CSW Status Definitions */ -#define CSW_CMD_PASSED 0x00 -#define CSW_CMD_FAILED 0x01 -#define CSW_PHASE_ERROR 0x02 - - -/* SCSI Commands */ -#define SCSI_TEST_UNIT_READY 0x00 -#define SCSI_REQUEST_SENSE 0x03 -#define SCSI_FORMAT_UNIT 0x04 -#define SCSI_INQUIRY 0x12 -#define SCSI_MODE_SELECT6 0x15 -#define SCSI_MODE_SENSE6 0x1A -#define SCSI_START_STOP_UNIT 0x1B -#define SCSI_MEDIA_REMOVAL 0x1E -#define SCSI_READ_FORMAT_CAPACITIES 0x23 -#define SCSI_READ_CAPACITY 0x25 -#define SCSI_READ10 0x28 -#define SCSI_WRITE10 0x2A -#define SCSI_VERIFY10 0x2F -#define SCSI_READ12 0xA8 -#define SCSI_WRITE12 0xAA -#define SCSI_MODE_SELECT10 0x55 -#define SCSI_MODE_SENSE10 0x5A - - -#endif /* __MSC_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_mscuser.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_mscuser.h deleted file mode 100644 index 60ef45a95..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_mscuser.h +++ /dev/null @@ -1,276 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_mscuser.h 577 2012-11-20 01:42:04Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* Mass Storage Class Custom User Module definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __MSCUSER_H__ -#define __MSCUSER_H__ - -#include "error.h" -#include "usbd.h" -#include "usbd_msc.h" -#include "usbd_core.h" -#include "app_usbd_cfg.h" - -/** \file - * \brief Mass Storage Class (MSC) API structures and function prototypes. - * - * Definition of functions exported by ROM based MSC function driver. - * - */ - -/** \ingroup Group_USBD - * @defgroup USBD_MSC Mass Storage Class (MSC) Function Driver - * \section Sec_MSCModDescription Module Description - * MSC Class Function Driver module. This module contains an internal implementation of the USB MSC Class. - * User applications can use this class driver instead of implementing the MSC class manually - * via the low-level USBD_HW and USBD_Core APIs. - * - * This module is designed to simplify the user code by exposing only the required interface needed to interface with - * Devices using the USB MSC Class. - */ - -/** \brief Mass Storage class function driver initialization parameter data structure. - * \ingroup USBD_MSC - * - * \details This data structure is used to pass initialization parameters to the - * Mass Storage class function driver's init function. - * - */ -typedef struct USBD_MSC_INIT_PARAM -{ - /* memory allocation params */ - uint32_t mem_base; /**< Base memory location from where the stack can allocate - data and buffers. \note The memory address set in this field - should be accessible by USB DMA controller. Also this value - should be aligned on 4 byte boundary. - */ - uint32_t mem_size; /**< The size of memory buffer which stack can use. - \note The \em mem_size should be greater than the size - returned by USBD_MSC_API::GetMemSize() routine.*/ - /* mass storage params */ - uint8_t* InquiryStr; /**< Pointer to the 28 character string. This string is - sent in response to the SCSI Inquiry command. \note The data - pointed by the pointer should be of global scope. - */ - uint32_t BlockCount; /**< Number of blocks present in the mass storage device */ - uint32_t BlockSize; /**< Block size in number of bytes */ - uint32_t MemorySize; /**< Memory size in number of bytes */ - /** Pointer to the interface descriptor within the descriptor - * array (\em high_speed_desc) passed to Init() through \ref USB_CORE_DESCS_T - * structure. The stack assumes both HS and FS use same BULK endpoints. - */ - - uint8_t* intf_desc; - /* user defined functions */ - - /** - * MSC Write callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a write command. - * - * \param[in] offset Destination start address. - * \param[in, out] src Pointer to a pointer to the source of data. Pointer-to-pointer - * is used to implement zero-copy buffers. See \ref USBD_ZeroCopy - * for more details on zero-copy concept. - * \param[in] length Number of bytes to be written. - * \return Nothing. - * - */ - void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length, uint32_t high_offset); - /** - * MSC Read callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a read command. - * - * \param[in] offset Source start address. - * \param[in, out] dst Pointer to a pointer to the source of data. The MSC function drivers - * implemented in stack are written with zero-copy model. Meaning the stack doesn't make an - * extra copy of buffer before writing/reading data from USB hardware FIFO. Hence the - * parameter is pointer to a pointer containing address buffer (uint8_t** dst). - * So that the user application can update the buffer pointer instead of copying data to - * address pointed by the parameter. /note The updated buffer address should be accessible - * by USB DMA master. If user doesn't want to use zero-copy model, then the user should copy - * data to the address pointed by the passed buffer pointer parameter and shouldn't change - * the address value. See \ref USBD_ZeroCopy for more details on zero-copy concept. - * \param[in] length Number of bytes to be read. - * \return Nothing. - * - */ - void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length, uint32_t high_offset); - /** - * MSC Verify callback function. - * - * This function is provided by the application software. This function gets called - * when host sends a verify command. The callback function should compare the buffer - * with the destination memory at the requested offset and - * - * \param[in] offset Destination start address. - * \param[in] buf Buffer containing the data sent by the host. - * \param[in] length Number of bytes to verify. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK If data in the buffer matches the data at destination - * \retval ERR_FAILED At least one byte is different. - * - */ - ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t buf[], uint32_t length, uint32_t high_offset); - /** - * Optional callback function to optimize MSC_Write buffer transfer. - * - * This function is provided by the application software. This function gets called - * when host sends SCSI_WRITE10/SCSI_WRITE12 command. The callback function should - * update the \em buff_adr pointer so that the stack transfers the data directly - * to the target buffer. /note The updated buffer address should be accessible - * by USB DMA master. If user doesn't want to use zero-copy model, then the user - * should not update the buffer pointer. See \ref USBD_ZeroCopy for more details - * on zero-copy concept. - * - * \param[in] offset Destination start address. - * \param[in,out] buf Buffer containing the data sent by the host. - * \param[in] length Number of bytes to write. - * \return Nothing. - * - */ - void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length, uint32_t high_offset); - - /** - * Optional user override-able function to replace the default MSC class handler. - * - * The application software could override the default EP0 class handler with their - * own by providing the handler function address as this data member of the parameter - * structure. Application which like the default handler should set this data member - * to zero before calling the USBD_MSC_API::Init(). - * \n - * \note - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in] data Pointer to the data which will be passed when callback function is called by the stack. - * \param[in] event Type of endpoint event. See \ref USBD_EVENT_T for more details. - * \return The call back should returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success. - * \retval ERR_USBD_UNHANDLED Event is not handled hence pass the event to next in line. - * \retval ERR_USBD_xxx For other error conditions. - * - */ - ErrorCode_t (*MSC_Ep0_Hdlr) (USBD_HANDLE_T hUsb, void* data, uint32_t event); - - uint64_t MemorySize64; - -} USBD_MSC_INIT_PARAM_T; - -/** \brief MSC class API functions structure. - * \ingroup USBD_MSC - * - * This module exposes functions which interact directly with USB device controller hardware. - * - */ -typedef struct USBD_MSC_API -{ - /** \fn uint32_t GetMemSize(USBD_MSC_INIT_PARAM_T* param) - * Function to determine the memory required by the MSC function driver module. - * - * This function is called by application layer before calling pUsbApi->msc->Init(), to allocate memory used - * by MSC function driver module. The application should allocate the memory which is accessible by USB - * controller/DMA controller. - * \note Some memory areas are not accessible by all bus masters. - * - * \param[in] param Structure containing MSC function driver module initialization parameters. - * \return Returns the required memory size in bytes. - */ - uint32_t (*GetMemSize)(USBD_MSC_INIT_PARAM_T* param); - - /** \fn ErrorCode_t init(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param) - * Function to initialize MSC function driver module. - * - * This function is called by application layer to initialize MSC function driver module. - * - * \param[in] hUsb Handle to the USB device stack. - * \param[in, out] param Structure containing MSC function driver module initialization parameters. - * \return Returns \ref ErrorCode_t type to indicate success or error condition. - * \retval LPC_OK On success - * \retval ERR_USBD_BAD_MEM_BUF Memory buffer passed is not 4-byte - * aligned or smaller than required. - * \retval ERR_API_INVALID_PARAM2 Either MSC_Write() or MSC_Read() or - * MSC_Verify() callbacks are not defined. - * \retval ERR_USBD_BAD_INTF_DESC Wrong interface descriptor is passed. - * \retval ERR_USBD_BAD_EP_DESC Wrong endpoint descriptor is passed. - */ - ErrorCode_t (*init)(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param); - -} USBD_MSC_API_T; - -/*----------------------------------------------------------------------------- - * Private functions & structures prototypes - *-----------------------------------------------------------------------------*/ -/** @cond ADVANCED_API */ - -typedef struct _MSC_CTRL_T -{ - /* If it's a USB HS, the max packet is 512, if it's USB FS, - the max packet is 64. Use 512 for both HS and FS. */ - /*ALIGNED(4)*/ uint8_t BulkBuf[USB_HS_MAX_BULK_PACKET]; /* Bulk In/Out Buffer */ - /*ALIGNED(4)*/MSC_CBW CBW; /* Command Block Wrapper */ - /*ALIGNED(4)*/MSC_CSW CSW; /* Command Status Wrapper */ - - USB_CORE_CTRL_T* pUsbCtrl; - - uint64_t Offset; /* R/W Offset */ - uint32_t Length; /* R/W Length */ - uint32_t BulkLen; /* Bulk In/Out Length */ - uint8_t* rx_buf; - - uint8_t BulkStage; /* Bulk Stage */ - uint8_t if_num; /* interface number */ - uint8_t epin_num; /* BULK IN endpoint number */ - uint8_t epout_num; /* BULK OUT endpoint number */ - uint32_t MemOK; /* Memory OK */ - - uint8_t* InquiryStr; - uint32_t BlockCount; - uint32_t BlockSize; - uint64_t MemorySize; - /* user defined functions */ - void (*MSC_Write)( uint32_t offset, uint8_t** src, uint32_t length, uint32_t high_offset); - void (*MSC_Read)( uint32_t offset, uint8_t** dst, uint32_t length, uint32_t high_offset); - ErrorCode_t (*MSC_Verify)( uint32_t offset, uint8_t src[], uint32_t length, uint32_t high_offset); - /* optional call back for MSC_Write optimization */ - void (*MSC_GetWriteBuf)( uint32_t offset, uint8_t** buff_adr, uint32_t length, uint32_t high_offset); - - -}USB_MSC_CTRL_T; - -/** @cond DIRECT_API */ -extern uint32_t mwMSC_GetMemSize(USBD_MSC_INIT_PARAM_T* param); -extern ErrorCode_t mwMSC_init(USBD_HANDLE_T hUsb, USBD_MSC_INIT_PARAM_T* param); -/** @endcond */ - -/** @endcond */ - - -#endif /* __MSCUSER_H__ */ - - - - - - diff --git a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_rom_api.h b/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_rom_api.h deleted file mode 100644 index 275ce0322..000000000 --- a/hw/mcu/nxp/lpc_chip_43xx/inc/usbd_rom/usbd_rom_api.h +++ /dev/null @@ -1,98 +0,0 @@ -/*********************************************************************** -* $Id:: mw_usbd_rom_api.h 331 2012-08-09 18:54:34Z usb10131 $ -* -* Project: USB device ROM Stack -* -* Description: -* ROM API Module definitions. -* -*********************************************************************** -* Copyright(C) 2011, NXP Semiconductor -* All rights reserved. -* -* Software that is described herein is for illustrative purposes only -* which provides customers with programming information regarding the -* products. This software is supplied "AS IS" without any warranties. -* NXP Semiconductors assumes no responsibility or liability for the -* use of the software, conveys no license or title under any patent, -* copyright, or mask work right to the product. NXP Semiconductors -* reserves the right to make changes in the software without -* notification. NXP Semiconductors also make no representation or -* warranty that such application will be suitable for the specified -* use without further testing or modification. -**********************************************************************/ -#ifndef __MW_USBD_ROM_API_H -#define __MW_USBD_ROM_API_H -/** \file - * \brief ROM API for USB device stack. - * - * Definition of functions exported by ROM based USB device stack. - * - */ - -#include "error.h" -#include "usbd.h" -#include "usbd_hw.h" -#include "usbd_core.h" -#include "usbd_mscuser.h" -#include "usbd_dfuuser.h" -#include "usbd_hiduser.h" -#include "usbd_cdcuser.h" - -/** \brief Main USBD API functions structure. - * \ingroup Group_USBD - * - * This structure contains pointer to various USB Device stack's sub-module - * function tables. This structure is used as main entry point to access - * various methods (grouped in sub-modules) exposed by ROM based USB device - * stack. - * - */ -typedef struct USBD_API -{ - const USBD_HW_API_T* hw; /**< Pointer to function table which exposes functions - which interact directly with USB device stack's core - layer.*/ - const USBD_CORE_API_T* core; /**< Pointer to function table which exposes functions - which interact directly with USB device controller - hardware.*/ - const USBD_MSC_API_T* msc; /**< Pointer to function table which exposes functions - provided by MSC function driver module. - */ - const USBD_DFU_API_T* dfu; /**< Pointer to function table which exposes functions - provided by DFU function driver module. - */ - const USBD_HID_API_T* hid; /**< Pointer to function table which exposes functions - provided by HID function driver module. - */ - const USBD_CDC_API_T* cdc; /**< Pointer to function table which exposes functions - provided by CDC-ACM function driver module. - */ - const uint32_t* reserved6; /**< Reserved for future function driver module. - */ - const uint32_t version; /**< Version identifier of USB ROM stack. The version is - defined as 0x0CHDMhCC where each nibble represents version - number of the corresponding component. - CC - 7:0 - 8bit core version number - h - 11:8 - 4bit hardware interface version number - M - 15:12 - 4bit MSC class module version number - D - 19:16 - 4bit DFU class module version number - H - 23:20 - 4bit HID class module version number - C - 27:24 - 4bit CDC class module version number - H - 31:28 - 4bit reserved - */ - -} USBD_API_T; - -/* Applications using USBD ROM API should define this instance. The pointer should be assigned a value computed based on chip definitions. */ -extern const USBD_API_T* g_pUsbApi; -#define USBD_API g_pUsbApi - -#endif /*__MW_USBD_ROM_API_H*/ - - - - - - -