usbcontrol.c File Reference

#include "type.h"
#include "usbdebug.h"
#include "usbstruct.h"
#include "usbapi.h"

Include dependency graph for usbcontrol.c:


Defines

#define MAX_CONTROL_SIZE   128
#define MAX_REQ_HANDLERS   4

Functions

void USBHandleControlTransfer (U8 bEP, U8 bEPStat)
void USBRegisterRequestHandler (int iType, TFnHandleRequest *pfnHandler, U8 *pbDataStore)

Detailed Description

Control transfer handler.

In case of a control-write (host-to-device), this module collects the full control message in a local buffer, then sends it off to an installed request handler.

In case of a control-read (device-to-host), an installed request handler is asked to handle the request and provide return data. The handler can either put the data in the control data buffer through the supplied pointer, or it can supply a new data pointer. In both cases, the handler is required to update the data length in *piLen;

Currently, control transfers are handled in a very simple way, keeping almost no state about the control transfer progress (setup stage, data stage, status stage). We simply follow the host: if it sends data, we store it in the control data buffer and if it asks for data, we just send the next block.


Define Documentation

#define MAX_CONTROL_SIZE   128
 

maximum total size of control transfer data

#define MAX_REQ_HANDLERS   4
 

standard, class, vendor, reserved


Function Documentation

void USBHandleControlTransfer U8  bEP,
U8  bEPStat
 

Handles IN/OUT transfers on EP0

Parameters:
[in] bEP Endpoint address
[in] bEPStat Endpoint status

void USBRegisterRequestHandler int  iType,
TFnHandleRequest pfnHandler,
U8 pbDataStore
 

Registers a callback for handling requests

Parameters:
[in] iType Type of request, e.g. REQTYPE_TYPE_STANDARD
[in] *pfnHandler Callback function pointer
[in] *pbDataStore Data storage area for this type of request


Generated on Sun Sep 3 23:15:10 2006 for LPCUSB by  doxygen 1.4.6