1 //***************************************************************************** 2 // 3 // usbdevice.h - types and definitions used during USB enumeration. 4 // 5 // Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved. 6 // Software License Agreement 7 // 8 // Texas Instruments (TI) is supplying this software for use solely and 9 // exclusively on TI's microcontroller products. The software is owned by 10 // TI and/or its suppliers, and is protected under applicable copyright 11 // laws. You may not combine this software with "viral" open-source 12 // software in order to form a larger program. 13 // 14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 // DAMAGES, FOR ANY REASON WHATSOEVER. 20 // 21 // 22 //***************************************************************************** 23 24 #ifndef __USBDEVICE_H__ 25 #define __USBDEVICE_H__ 26 27 //***************************************************************************** 28 // 29 // If building with a C++ compiler, make all of the definitions in this header 30 // have a C binding. 31 // 32 //***************************************************************************** 33 #ifdef __cplusplus 34 extern "C" 35 { 36 #endif 37 38 //***************************************************************************** 39 // 40 //! \addtogroup device_api 41 //! @{ 42 // 43 //***************************************************************************** 44 45 //***************************************************************************** 46 // 47 //! The maximum number of independent interfaces that any single device 48 //! implementation can support. Independent interfaces means interface 49 //! descriptors with different bInterfaceNumber values - several interface 50 //! descriptors offering different alternative settings but the same interface 51 //! number count as a single interface. 52 // 53 //***************************************************************************** 54 #define USB_MAX_INTERFACES_PER_DEVICE 8 55 56 //***************************************************************************** 57 // 58 // Close the Doxygen group. 59 //! @} 60 // 61 //***************************************************************************** 62 63 //***************************************************************************** 64 // 65 // The default USB endpoint FIFO configuration structure. This structure 66 // contains definitions to set all USB FIFOs into single buffered mode with 67 // no DMA use. Each endpoint's FIFO is sized to hold the largest maximum 68 // packet size for any interface alternate setting in the current config 69 // descriptor. A pointer to this structure may be passed in the psFIFOConfig 70 // field of the tDeviceInfo structure passed to USBCDCInit if the application 71 // does not require any special handling of the USB controller FIFO. 72 // 73 //***************************************************************************** 74 extern const tFIFOConfig g_sUSBDefaultFIFOConfig; 75 76 //***************************************************************************** 77 // 78 // Public APIs offered by the USB library device control driver. 79 // 80 //***************************************************************************** 81 extern void USBDCDInit(uint32 ulIndex, tDeviceInfo *psDevice); 82 extern void USBDCDTerm(uint32 ulIndex); 83 extern void USBDCDStallEP0(uint32 ulIndex); 84 extern void USBDCDRequestDataEP0(uint32 ulIndex, uint8 *pucData, 85 uint32 ulSize); 86 extern void USBDCDSendDataEP0(uint32 ulIndex, uint8 *pucData, 87 uint32 ulSize); 88 extern void USBDCDSetDefaultConfiguration(uint32 ulIndex, 89 uint32 ulDefaultConfig); 90 extern uint32 USBDCDConfigDescGetSize(const tConfigHeader *psConfig); 91 extern uint32 USBDCDConfigDescGetNum(const tConfigHeader *psConfig, 92 uint32 ulType); 93 extern tDescriptorHeader *USBDCDConfigDescGet(const tConfigHeader *psConfig, 94 uint32 ulType, 95 uint32 ulIndex, 96 uint32 *pulSection); 97 extern uint32 98 USBDCDConfigGetNumAlternateInterfaces(const tConfigHeader *psConfig, 99 uint8 ucInterfaceNumber); 100 extern tInterfaceDescriptor * 101 USBDCDConfigGetInterface(const tConfigHeader *psConfig, 102 uint32 ulIndex, uint32 ulAltCfg, 103 uint32 *pulSection); 104 extern tEndpointDescriptor * 105 USBDCDConfigGetInterfaceEndpoint(const tConfigHeader *psConfig, 106 uint32 ulInterfaceNumber, 107 uint32 ulAltCfg, 108 uint32 ulIndex); 109 extern void USBDCDPowerStatusSet(uint32 ulIndex, uint8 ucPower); 110 extern tBoolean USBDCDRemoteWakeupRequest(uint32 ulIndex); 111 112 //***************************************************************************** 113 // 114 // Early releases of the USB library had the following function named 115 // incorrectly. This macro ensures that any code which used the previous name 116 // will still operate as expected. 117 // 118 //***************************************************************************** 119 #ifndef DEPRECATED 120 #define USBCDCConfigGetInterfaceEndpoint(a, b, c, d) \ 121 USBDCDConfigGetInterfaceEndpoint((a), (b), (c), (d)) 122 #endif 123 124 //***************************************************************************** 125 // 126 // Device mode interrupt handler for controller index 0. 127 // 128 //***************************************************************************** 129 extern void USB0DeviceIntHandler(void); 130 131 //***************************************************************************** 132 // 133 // Mark the end of the C bindings section for C++ compilers. 134 // 135 //***************************************************************************** 136 #ifdef __cplusplus 137 } 138 #endif 139 140 #endif // __USBENUM_H__ 141