_c5509_usb.h
上传用户:dahaojd
上传日期:2008-01-29
资源大小:14357k
文件大小:6k
- /*
- * Copyright 2003 by Texas Instruments Incorporated.
- * All rights reserved. Property of Texas Instruments Incorporated.
- * Restricted rights to use, duplicate or disclose this code are
- * granted through contract.
- *
- */
- /* "@(#) DDK 1.10.00.23 07-02-03 (ddk-b12)" */
- /*
- * ======== _c5509_usb.h ========
- * This file defines internal data struct and data for C5509 USB IOM
- * mini-driver.
- */
- #ifndef _C5509_USB_
- #define _C5509_USB_
- #include <csl.h>
- #include <csl_std.h>
- #include <csl_usb.h>
- #include <iom.h>
- #include <c5509_usb.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- /*
- * Total number of USB endpoints supported by device.
- */
- #define _C5509_USB_ENDPTNUMS 16 /* 16 endpoints in C5509 */
- /*
- * Internal mini-driver control endpoint(EP) 0 attrs.
- */
- #define _C5509_USB_NUMEPSRSVD 2 /* EP0 IN & OUT reserved for control */
- #define _C5509_USB_EP0RSVDSIZE 64 /* EP0 max transfer size in bytes */
- /*
- * Internal EP 0 IN & OUT event mask
- */
- #define _C5509_USB_EP0RSVDMASK (USB_EVENT_RESET | USB_EVENT_SETUP |
- USB_EVENT_SUSPEND | USB_EVENT_RESUME | USB_EVENT_EOT)
- /*
- * Desired clock frequency (in MHz) for the USB module.
- * Must be 48 MHz for the proper operation of the USB device.
- * Used in CSL USB_initPLL() call.
- */
- #define _C5509_USB_OUTCLK48MHZ 48
- /*
- * Internal endpoint control objects
- */
- extern USB_EpObj _C5509_USB_usbEpObjIn0, _C5509_USB_usbEpObjOut0;
- /*
- * Internal pointer to device parameters.
- */
- extern C5509_USB_DevParams *_C5509_USB_devParams;
- /*
- * USB setup packet
- */
- extern USB_SetupStruct _C5509_USB_usbSetup;
- /*
- * global device object -- initialized by mdBindDev
- */
- typedef struct _C5509_USB_DevObj {
- volatile Bool busConnected; /* Set TRUE after host enumerates bus */
- Uint16 lastRequest; /* last control channel request */
- C5509_USB_ChanHandle chans[_C5509_USB_ENDPTNUMS]; /* IOM chan ptr array */
- USB_EpHandle eps[_C5509_USB_ENDPTNUMS+1]; /* array of null term'd EPs */
- C5509_USB_StateInfo stateInfo;
- } _C5509_USB_DevObj, *_C5509_USB_DevHandle;
- extern _C5509_USB_DevObj _C5509_USB_devObj;
- typedef struct {
- Uint16 request; /* request ID */
- C5509_USB_UsbReqHandler usbReqHandler; /* request handler function ptr */
- } _C5509_USB_UsbRequestStruct;
- /*
- * USB request unknown or not implemented supported
- */
- C5509_USB_UsbReqRet _C5509_USB_usbReqUnknown();
-
- /*
- * look up request handler in table
- */
- C5509_USB_UsbReqHandler _C5509_USB_usbLookupReqHandler( Uint16 request);
- /*
- * ======== _C5509_USB_mdBindDev ========
- */
- Int _C5509_USB_mdBindDev(Ptr *devp, Int devid, Ptr devParams);
- /*
- * ======== _C5509_USB_mdControlChan ========
- */
- Int _C5509_USB_mdControlChan(Ptr chanp, Uns cmd, Ptr args);
- /*
- * ======== _C5509_USB_mdCreateChan ========
- */
- Int _C5509_USB_mdCreateChan(Ptr *chanp, Ptr devp, String name,
- Int mode, Ptr chanParams, IOM_TiomCallback cbFxn,Ptr cbArg);
- /*
- * ======== _C5509_USB_mdSubmitChan ========
- */
- Int _C5509_USB_mdSubmitChan(Ptr chanp, IOM_Packet *packet);
- /*
- * ======== Transaction handler ========
- * This function processes actual IO for the associated endpoint
- */
- Void _C5509_USB_transactionHandler(C5509_USB_ChanHandle chan);
- /*
- * ======== _C5509_USB_flushPacketHandler ========
- * This function performs an IOM channel flush.
- */
- Void _C5509_USB_flushPacketHandler(C5509_USB_ChanHandle chan,
- IOM_Packet *flushPacket);
- /*
- * ======== removePackets ========
- * This function cancels all pending IOs for a channel.
- */
- Void _C5509_USB_removePackets(Ptr chanp, Int status);
- /*
- * ======== _C5509_USB_freeAllPackets ========
- * This function cancels pending IOs for all channels.
- */
- Void _C5509_USB_freeAllPackets(Void);
- /*
- * ======== _C5509_USB_reInitUsb ========
- * This function re-init usb module and set device state to default.
- */
- Void _C5509_USB_reInitUsb(Void);
- /*
- * ======== control endpoint 0 handler ========
- */
- Void _C5509_USB_usbCtrlHandler(Void);
- /*
- * The following are USB descriptor definitions. Refer to USB 1.x spec.
- */
- #define _C5509_USB_REQUEST_GET_STATUS 0x8000 /* Requests */
- #define _C5509_USB_REQUEST_CLEAR_FEATURE 0x0001
- #define _C5509_USB_REQUEST_SET_FEATURE 0x0003
- #define _C5509_USB_REQUEST_SET_ADDRESS 0x0005
- #define _C5509_USB_REQUEST_GET_DESCRIPTOR 0x8006
- #define _C5509_USB_REQUEST_SET_DESCRIPTOR 0x0007
- #define _C5509_USB_REQUEST_GET_CONFIGURATION 0x8008
- #define _C5509_USB_REQUEST_SET_CONFIGURATION 0x0009
- #define _C5509_USB_REQUEST_GET_INTERFACE 0x800A
- #define _C5509_USB_REQUEST_SET_INTERFACE 0x000B
- #define _C5509_USB_REQUEST_SYNC_FRAME 0x800C
- #define _C5509_USB_REQUEST_BULK_ONLY_RESET 0x20FF
- #define _C5509_USB_REQUEST_GET_MAX_LUN 0xA0FE
- #define _C5509_USB_DEVICE_CLASS_RESERVED 0x00 /* Device Classes */
- #define _C5509_USB_DEVICE_CLASS_AUDIO 0x01
- #define _C5509_USB_DEVICE_CLASS_COMMUNICATIONS 0x02
- #define _C5509_USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
- #define _C5509_USB_DEVICE_CLASS_MONITOR 0x04
- #define _C5509_USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
- #define _C5509_USB_DEVICE_CLASS_POWER 0x06
- #define _C5509_USB_DEVICE_CLASS_PRINTER 0x07
- #define _C5509_USB_DEVICE_CLASS_STORAGE 0x08
- #define _C5509_USB_DEVICE_CLASS_HUB 0x09
- #define _C5509_USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
- #define _C5509_USB_FEATURE_ENDPOINT_STALL 0x0000 /* Feature Selector */
- #define _C5509_USB_FEATURE_REMOTE_WAKEUP 0x0001
- #define _C5509_USB_FEATURE_POWER_D0 0x0002
- #define _C5509_USB_FEATURE_POWER_D1 0x0003
- #define _C5509_USB_FEATURE_POWER_D2 0x0004
- #define _C5509_USB_FEATURE_POWER_D3 0x0005
- #ifdef __cplusplus
- }
- #endif
- #endif /* _C5509_USB_ */
-