#include "type.h"
#include "usbdebug.h"
#include "usbhw_lpc.h"
#include "usbapi.h"
Include dependency graph for usbhw_lpc.c:
Defines | |
#define | DEBUG_LED_INIT(x) |
#define | DEBUG_LED_ON(x) |
#define | DEBUG_LED_OFF(x) |
#define | EP2IDX(bEP) ((((bEP)&0xF)<<1)|(((bEP)&0x80)>>7)) |
#define | IDX2EP(idx) ((((idx)<<7)&0x80)|(((idx)>>1)&0xF)) |
Functions | |
void | USBHwEPConfig (U8 bEP, U16 wMaxPacketSize) |
void | USBHwRegisterEPIntHandler (U8 bEP, TFnEPIntHandler *pfnHandler) |
void | USBHwRegisterDevIntHandler (TFnDevIntHandler *pfnHandler) |
void | USBHwRegisterFrameHandler (TFnFrameHandler *pfnHandler) |
void | USBHwSetAddress (U8 bAddr) |
void | USBHwConnect (BOOL fConnect) |
void | USBHwNakIntEnable (U8 bIntBits) |
BOOL | USBHwEPIsStalled (U8 bEP) |
void | USBHwEPStall (U8 bEP, BOOL fStall) |
int | USBHwEPWrite (U8 bEP, U8 *pbBuf, int iLen) |
int | USBHwEPRead (U8 bEP, U8 *pbBuf, int iMaxLen) |
void | USBHwConfigDevice (BOOL fConfigured) |
void | USBHwISR (void) |
BOOL | USBHwInit (void) |
|
LED initialisation macro |
|
turn LED off |
|
turn LED on |
|
convert from endpoint address to endpoint index |
|
convert from endpoint index to endpoint address |
|
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.
|