+/rtos
git clone https://git.julia.blue/+/rtos
326af29
master
1//***************************************************************************** 2// 3// usbdevice.h - types and definitions used during USB enumeration. 4// 5// Copyright (c) 2008-2017 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// This is part of revision 2.1.4.178 of the Tiva USB Library. 22// 23//***************************************************************************** 24 25#ifndef __USBDEVICE_H__ 26#define __USBDEVICE_H__ 27#include "usblib/usblib.h" 28 29//***************************************************************************** 30// 31// If building with a C++ compiler, make all of the definitions in this header 32// have a C binding. 33// 34//***************************************************************************** 35#ifdef __cplusplus 36extern "C" { 37#endif 38 39//***************************************************************************** 40// 41//! \addtogroup device_api 42//! @{ 43// 44//***************************************************************************** 45 46//***************************************************************************** 47// 48//! The maximum number of independent interfaces that any single device 49//! implementation can support. Independent interfaces means interface 50//! descriptors with different \e bInterfaceNumber values - several interface 51//! descriptors offering different alternative settings but the same interface 52//! number count as a single interface. 53// 54//***************************************************************************** 55#define USB_MAX_INTERFACES_PER_DEVICE 8 56 57#include "usblib/device/usbdevicepriv.h" 58 59//***************************************************************************** 60// 61//! This structure is passed to the USB library on a call to USBDCDInit and 62//! provides the library with information about the device that the 63//! application is implementing. It contains functions pointers for the 64//! various USB event handlers and pointers to each of the standard device 65//! descriptors. 66// 67//***************************************************************************** 68struct tDeviceInfo { 69// 70//! A pointer to a structure containing pointers to event handler functions 71//! provided by the client to support the operation of this device. 72// 73const tCustomHandlers * psCallbacks ; 74 75// 76//! A pointer to the device descriptor for this device. 77// 78const uint8_t * pui8DeviceDescriptor ; 79 80// 81//! A pointer to an array of configuration descriptor pointers. Each entry 82//! in the array corresponds to one configuration that the device may be 83//! set to use by the USB host. The number of entries in the array must 84//! match the bNumConfigurations value in the device descriptor 85//! array, \e pui8DeviceDescriptor. 86// 87const tConfigHeader * const * ppsConfigDescriptors ; 88 89// 90//! A pointer to the string descriptor array for this device. This array 91//! must be arranged as follows: 92//! 93//! [0] - Standard descriptor containing supported language codes. 94//! 95//! [1] - String 1 for the first language listed in descriptor 0. 96//! 97//! [2] - String 2 for the first language listed in descriptor 0. 98//! 99//! ... 100//! 101//! [n] - String n for the first language listed in descriptor 0. 102//! 103//! [n+1] - String 1 for the second language listed in descriptor 0. 104//! 105//! ... 106//! 107//! [2n] - String n for the second language listed in descriptor 0. 108//! 109//! [2n+1]- String 1 for the third language listed in descriptor 0. 110//! 111//! ... 112//! 113//! [3n] - String n for the third language listed in descriptor 0. 114//! 115//! and so on. 116// 117const uint8_t * const * ppui8StringDescriptors ; 118 119// 120//! The total number of descriptors provided in the ppStringDescriptors 121//! array. 122// 123uint32_t ui32NumStringDescriptors ; 124}; 125 126//***************************************************************************** 127// 128//! This type is used by an application to describe and instance of a device 129//! and an instance data pointer for that class. The psDevice pointer should 130//! be a pointer to a valid device class to include in the composite device. 131//! The pvInstance pointer should be a pointer to an instance pointer for the 132//! device in the psDevice pointer. 133//! 134// 135//***************************************************************************** 136typedef struct { 137// 138//! This is the top level device information structure. 139// 140const struct tDeviceInfo * psDevInfo ; 141 142// 143//! This is the instance data for the device structure. 144// 145void * pvInstance ; 146 147// 148//! A per-device workspace used by the composite device. 149// 150uint32_t ui32DeviceWorkspace ; 151}tCompositeEntry ; 152 153//***************************************************************************** 154// 155// Close the Doxygen group. 156//! @} 157// 158//***************************************************************************** 159 160//***************************************************************************** 161// 162// Public APIs offered by the USB library device control driver. 163// 164//***************************************************************************** 165extern void USBDCDInit (uint32_t ui32Index ,struct tDeviceInfo * psDevice , 166void * pvDCDCBData ); 167extern void USBDCDTerm (uint32_t ui32Index ); 168extern void USBDCDStallEP0 (uint32_t ui32Index ); 169extern void USBDCDRequestDataEP0 (uint32_t ui32Index ,uint8_t * pui8Data , 170uint32_t ui32Size ); 171extern void USBDCDSendDataEP0 (uint32_t ui32Index ,uint8_t * pui8Data , 172uint32_t ui32Size ); 173extern void USBDCDSetDefaultConfiguration (uint32_t ui32Index , 174uint32_t ui32DefaultConfig ); 175extern uint32_t USBDCDConfigDescGetSize (const tConfigHeader * psConfig ); 176extern uint32_t USBDCDConfigDescGetNum (const tConfigHeader * psConfig , 177uint32_t ui32Type ); 178extern tDescriptorHeader * USBDCDConfigDescGet (const tConfigHeader * psConfig , 179uint32_t ui32Type , 180uint32_t ui32Index , 181uint32_t * pui32Section ); 182extern uint32_t 183USBDCDConfigGetNumAlternateInterfaces (const tConfigHeader * psConfig , 184uint8_t ui8InterfaceNumber ); 185extern tInterfaceDescriptor * 186USBDCDConfigGetInterface (const tConfigHeader * psConfig ,uint32_t ui32Index , 187uint32_t ui32AltCfg ,uint32_t * pui32Section ); 188extern tEndpointDescriptor * 189USBDCDConfigGetInterfaceEndpoint (const tConfigHeader * psConfig , 190uint32_t ui32InterfaceNumber , 191uint32_t ui32AltCfg ,uint32_t ui32Index ); 192extern bool USBDCDRemoteWakeupRequest (uint32_t ui32Index ); 193extern bool USBDCDFeatureSet (uint32_t ui32Index ,uint32_t ui32Feature , 194void * pvFeature ); 195extern bool USBDCDFeatureGet (uint32_t ui32Index ,uint32_t ui32Feature , 196void * pvFeature ); 197extern bool USBDCDRemoteWakeLPM (uint32_t ui32Index ); 198 199//***************************************************************************** 200// 201// Device mode interrupt handler for controller index 0. 202// 203//***************************************************************************** 204extern void USB0DeviceIntHandler (void ); 205 206//***************************************************************************** 207// 208// The following APIs are deprecated. 209// 210//***************************************************************************** 211#ifndef DEPRECATED 212 213// 214// Use USBDCDFeatureSet() or USBHCDFeatureSet() with \b USBLIB_FEATURE_POWER 215// configuration option. 216// 217extern void USBDCDPowerStatusSet (uint32_t ui32Index ,uint8_t ui8Power ); 218#endif 219 220//***************************************************************************** 221// 222// Mark the end of the C bindings section for C++ compilers. 223// 224//***************************************************************************** 225#ifdef __cplusplus 226} 227#endif 228 229#endif // __USBENUM_H__