+/rtos
git clone https://git.julia.blue/+/rtos
326af29
master
1//***************************************************************************** 2// 3// usbdevicepriv.h - Private header file used to share internal variables and 4// function prototypes between the various device-related 5// modules in the USB library. This header MUST NOT be 6// used by application code. 7// 8// Copyright (c) 2008-2017 Texas Instruments Incorporated. All rights reserved. 9// Software License Agreement 10// 11// Texas Instruments (TI) is supplying this software for use solely and 12// exclusively on TI's microcontroller products. The software is owned by 13// TI and/or its suppliers, and is protected under applicable copyright 14// laws. You may not combine this software with "viral" open-source 15// software in order to form a larger program. 16// 17// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 18// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 19// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 21// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 22// DAMAGES, FOR ANY REASON WHATSOEVER. 23// 24// This is part of revision 2.1.4.178 of the Tiva USB Library. 25// 26//***************************************************************************** 27 28#ifndef __USBDEVICEPRIV_H__ 29#define __USBDEVICEPRIV_H__ 30#include "usblib/device/usbdevice.h" 31#include "usblib/usblib.h" 32 33//***************************************************************************** 34// 35// If building with a C++ compiler, make all of the definitions in this header 36// have a C binding. 37// 38//***************************************************************************** 39#ifdef __cplusplus 40extern "C" { 41#endif 42 43//***************************************************************************** 44// 45// The states for endpoint zero during enumeration. 46// 47//***************************************************************************** 48typedef enum { 49// 50// The USB device is waiting on a request from the host controller on 51// endpoint zero. 52// 53eUSBStateIdle , 54 55// 56// The USB device is sending data back to the host due to an IN request. 57// 58eUSBStateTx , 59 60// 61// The USB device is sending the configuration descriptor back to the host 62// due to an IN request. 63// 64eUSBStateTxConfig , 65 66// 67// The USB device is receiving data from the host due to an OUT 68// request from the host. 69// 70eUSBStateRx , 71 72// 73// The USB device has completed the IN or OUT request and is now waiting 74// for the host to acknowledge the end of the IN/OUT transaction. This 75// is the status phase for a USB control transaction. 76// 77eUSBStateStatus , 78 79// 80// This endpoint has signaled a stall condition and is waiting for the 81// stall to be acknowledged by the host controller. 82// 83eUSBStateStall 84}tEP0State ; 85 86typedef struct tDeviceInfo tDeviceInfo ; 87 88//***************************************************************************** 89// 90// The USB controller device information. 91// 92//***************************************************************************** 93typedef struct { 94// 95// The current state of endpoint zero. 96// 97volatile tEP0State iEP0State ; 98 99// 100// The devices current address, this also has a change pending bit in the 101// MSB of this value specified by DEV_ADDR_PENDING. 102// 103volatile uint32_t ui32DevAddress ; 104 105// 106// This holds the current active configuration for this device. 107// 108uint32_t ui32Configuration ; 109 110// 111// This holds the configuration id that will take effect after a reset. 112// 113uint32_t ui32DefaultConfiguration ; 114 115// 116// This holds the current alternate interface for this device. 117// 118uint8_t pui8AltSetting [USB_MAX_INTERFACES_PER_DEVICE ]; 119 120// 121// This is the pointer to the current data being sent out or received 122// on endpoint zero. 123// 124uint8_t * pui8EP0Data ; 125 126// 127// This is the number of bytes that remain to be sent from or received 128// into the g_sUSBDeviceState.pui8EP0Data data buffer. 129// 130volatile uint32_t ui32EP0DataRemain ; 131 132// 133// The amount of data being sent/received due to a custom request. 134// 135uint32_t ui32OUTDataSize ; 136 137// 138// Holds the current device status. 139// 140uint8_t ui8Status ; 141 142// 143// Holds the endpoint status for the HALT condition. This array is sized 144// to hold halt status for all IN and OUT endpoints. 145// 146uint8_t ppui8Halt [2 ][USBLIB_NUM_EP - 1 ]; 147 148// 149// Holds the configuration descriptor section number currently being sent 150// to the host. 151// 152uint8_t ui8ConfigSection ; 153 154// 155// Holds the offset within the configuration descriptor section currently 156// being sent to the host. 157// 158uint16_t ui16SectionOffset ; 159 160// 161// Holds the index of the configuration that we are currently sending back 162// to the host. 163// 164uint8_t ui8ConfigIndex ; 165 166// 167// This flag is set to true if the client has called USBDPowerStatusSet() 168// and tells the USB library not to try to determine the current power 169// status from the configuration descriptor. 170// 171bool bPwrSrcSet ; 172 173// 174// This flag indicates whether or not remote wake up signaling is in 175// progress. 176// 177bool bRemoteWakeup ; 178 179// 180// During remote wake up signaling, this counter is used to track the 181// number of milliseconds since the signaling was initiated. 182// 183uint8_t ui8RemoteWakeupCount ; 184 185// 186// The DMA instance information for this USB controller. 187// 188tUSBDMAInstance * psDMAInstance ; 189 190// 191// The interrupt number for this instance. 192// 193uint32_t ui32IntNum ; 194 195// 196// Pointer to the device supplied call back data. 197// 198void * pvCBData ; 199 200// 201// This holds the state of the LPM support for the device. 202// 203uint32_t ui32LPMState ; 204 205// 206// Device feature flags. 207// 208uint32_t ui32Features ; 209}tDCDInstance ; 210 211extern tDCDInstance g_psDCDInst []; 212extern tDeviceInfo * g_ppsDevInfo []; 213 214//***************************************************************************** 215// 216// Device enumeration functions provided by device/usbenum.c and called from 217// the interrupt handler in device/usbhandler.c 218// 219//***************************************************************************** 220extern bool USBDeviceConfig (tDCDInstance * psDevInst , 221const tConfigHeader * psConfig ); 222extern bool USBDeviceConfigAlternate (tDCDInstance * psDevInst , 223const tConfigHeader * psConfig , 224uint8_t ui8InterfaceNum , 225uint8_t ui8AlternateSetting ); 226 227extern void USBDCDDeviceInfoInit (uint32_t ui32Index ,tDeviceInfo * psDevice ); 228 229//***************************************************************************** 230// 231// Macro access function to device information. 232// 233//***************************************************************************** 234#define DCDGetDMAInstance (psDevInfo ) (&(psDevInfo->psDCDInst->sDMAInstance)) 235 236//***************************************************************************** 237// 238// Mark the end of the C bindings section for C++ compilers. 239// 240//***************************************************************************** 241#ifdef __cplusplus 242} 243#endif 244 245#endif // __USBDEVICEPRIV_H__