#include "type.h"
#include "usbstruct.h"
Include dependency graph for usbapi.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | MAX_PACKET_SIZE0 64 |
#define | EP_STATUS_DATA (1<<0) |
#define | EP_STATUS_STALLED (1<<1) |
#define | EP_STATUS_SETUP (1<<2) |
#define | EP_STATUS_NACKED (1<<3) |
#define | EP_STATUS_ERROR (1<<4) |
#define | DEV_STATUS_CONNECT (1<<0) |
#define | DEV_STATUS_SUSPEND (1<<2) |
#define | DEV_STATUS_RESET (1<<4) |
#define | INACK_CI (1<<1) |
#define | INACK_CO (1<<2) |
#define | INACK_II (1<<3) |
#define | INACK_IO (1<<4) |
#define | INACK_BI (1<<5) |
#define | INACK_BO (1<<6) |
Typedefs | |
typedef void() | TFnEPIntHandler (U8 bEP, U8 bEPStatus) |
typedef void() | TFnDevIntHandler (U8 bDevStatus) |
typedef void() | TFnFrameHandler (U16 wFrame) |
typedef BOOL() | TFnHandleRequest (TSetupPacket *pSetup, int *piLen, U8 **ppbData) |
typedef BOOL() | TFnGetDescriptor (U16 wTypeIndex, U16 wLangID, int *piLen, U8 **ppbData) |
Functions | |
BOOL | USBHwInit (void) |
void | USBHwISR (void) |
void | USBHwNakIntEnable (U8 bIntBits) |
void | USBHwConnect (BOOL fConnect) |
void | USBHwSetAddress (U8 bAddr) |
void | USBHwConfigDevice (BOOL fConfigured) |
void | USBHwEPConfig (U8 bEP, U16 wMaxPacketSize) |
int | USBHwEPRead (U8 bEP, U8 *pbBuf, int iMaxLen) |
int | USBHwEPWrite (U8 bEP, U8 *pbBuf, int iLen) |
void | USBHwEPStall (U8 bEP, BOOL fStall) |
BOOL | USBHwEPIsStalled (U8 bEP) |
void | USBHwRegisterEPIntHandler (U8 bEP, TFnEPIntHandler *pfnHandler) |
void | USBHwRegisterDevIntHandler (TFnDevIntHandler *pfnHandler) |
void | USBHwRegisterFrameHandler (TFnFrameHandler *pfnHandler) |
BOOL | USBInit (void) |
void | USBRegisterRequestHandler (int iType, TFnHandleRequest *pfnHandler, U8 *pbDataStore) |
void | USBRegisterCustomReqHandler (TFnHandleRequest *pfnHandler) |
BOOL | USBHandleStandardRequest (TSetupPacket *pSetup, int *piLen, U8 **ppbData) |
void | USBHandleControlTransfer (U8 bEP, U8 bEPStat) |
void | USBRegisterDescriptors (const U8 *pabDescriptors) |
BOOL | USBGetDescriptor (U16 wTypeIndex, U16 wLangID, int *piLen, U8 **ppbData) |
|
device just got connected |
|
device just got reset |
|
device entered suspend state |
|
EP has data |
|
EP data was overwritten by setup packet |
|
EP sent NAK |
|
EP received setup packet |
|
EP is stalled |
|
interrupt on NACK for bulk in |
|
interrupt on NACK for bulk out |
|
interrupt on NACK for control in |
|
interrupt on NACK for control out |
|
interrupt on NACK for interrupt in |
|
interrupt on NACK for interrupt out |
|
maximum packet size for EP 0 |
|
Device status handler callback |
|
Endpoint interrupt handler callback |
|
Frame event handler callback |
|
Descriptor handler callback |
|
Request handler callback (standard, vendor, class) |
|
Parses the list of installed USB descriptors and attempts to find the specified USB descriptor.
|
|
Handles IN/OUT transfers on EP0
|
|
Default handler for standard ('chapter 9') requests If a custom request handler was installed, this handler is called first.
|
|
Sets the 'configured' state. All registered endpoints are 'realised' and enabled, and the 'configured' bit is set in the device status register.
|
|
Connects or disconnects from the USB bus
|
|
Configures an endpoint and enables it
|
|
Gets the stalled property of an endpoint
|
|
Reads data from an endpoint buffer
|
|
Sets the stalled property of an endpoint
|
|
Writes data to an endpoint buffer
|
|
Initialises the USB hardware This function assumes that the hardware is connected as shown in section 10.1 of the LPC2148 data sheet: P0.31 controls a switch to connect a 1.5k pull-up to D+ if low. P0.23 is connected to USB VCC. Embedded artists board: make sure to disconnect P0.23 LED as it acts as a pull-up and so prevents detection of USB disconnect.
|
|
USB interrupt handler Endpoint interrupts are mapped to the slow interrupt |
|
Enables interrupt on NAK condition For IN endpoints a NAK is generated when the host wants to read data from the device, but none is available in the endpoint buffer. For OUT endpoints a NAK is generated when the host wants to write data to the device, but the endpoint buffer is still full. The endpoint interrupt handlers can distinguish regular (ACK) interrupts from NAK interrupt by checking the bits in their bEPStatus argument.
|
|
Registers an device status callback
|
|
Registers an endpoint event callback
|
|
Registers the frame callback
|
|
Sets the USB address.
|
|
Initialises the USB hardware and sets up the USB stack by installing default callbacks.
|
|
Registers a callback for custom device requests In USBHandleStandardRequest, the custom request handler gets a first chance at handling the request before it is handed over to the 'chapter 9' request handler. This can be used for example in HID devices, where a REQ_GET_DESCRIPTOR request is sent to an interface, which is not covered by the 'chapter 9' specification.
|
|
Registers a pointer to a descriptor block containing all descriptors for the device.
|
|
Registers a callback for handling requests
|