+/rtos
git clone https://git.julia.blue/+/rtos
da8d6f3
master
1//***************************************************************************** 2// 3// usb.h - Prototypes for the USB Interface Driver. 4// 5// Copyright (c) 2007-2017 Texas Instruments Incorporated. All rights reserved. 6// Software License Agreement 7// 8// Redistribution and use in source and binary forms, with or without 9// modification, are permitted provided that the following conditions 10// are met: 11// 12// Redistributions of source code must retain the above copyright 13// notice, this list of conditions and the following disclaimer. 14// 15// Redistributions in binary form must reproduce the above copyright 16// notice, this list of conditions and the following disclaimer in the 17// documentation and/or other materials provided with the 18// distribution. 19// 20// Neither the name of Texas Instruments Incorporated nor the names of 21// its contributors may be used to endorse or promote products derived 22// from this software without specific prior written permission. 23// 24// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35// 36// This is part of revision 2.1.4.178 of the Tiva Peripheral Driver Library. 37// 38//***************************************************************************** 39 40#ifndef __DRIVERLIB_USB_H__ 41#define __DRIVERLIB_USB_H__ 42#include <stdbool.h> 43#include <stdint.h> 44 45//***************************************************************************** 46// 47// If building with a C++ compiler, make all of the definitions in this header 48// have a C binding. 49// 50//***************************************************************************** 51#ifdef __cplusplus 52extern "C" { 53#endif 54 55//***************************************************************************** 56// 57// The following are values that can be passed to USBIntEnableControl() and 58// USBIntDisableControl() as the ui32Flags parameter, and are returned from 59// USBIntStatusControl(). 60// 61//***************************************************************************** 62#define USB_INTCTRL_ALL 0x000003FF // All control interrupt sources 63#define USB_INTCTRL_STATUS 0x000000FF // Status Interrupts 64#define USB_INTCTRL_VBUS_ERR 0x00000080 // VBUS Error 65#define USB_INTCTRL_SESSION 0x00000040 // Session Start Detected 66#define USB_INTCTRL_SESSION_END 0x00000040 // Session End Detected 67#define USB_INTCTRL_DISCONNECT 0x00000020 // Disconnect Detected 68#define USB_INTCTRL_CONNECT 0x00000010 // Device Connect Detected 69#define USB_INTCTRL_SOF 0x00000008 // Start of Frame Detected 70#define USB_INTCTRL_BABBLE 0x00000004 // Babble signaled 71#define USB_INTCTRL_RESET 0x00000004 // Reset signaled 72#define USB_INTCTRL_RESUME 0x00000002 // Resume detected 73#define USB_INTCTRL_SUSPEND 0x00000001 // Suspend detected 74#define USB_INTCTRL_MODE_DETECT 0x00000200 // Mode value valid 75#define USB_INTCTRL_POWER_FAULT 0x00000100 // Power Fault detected 76 77//***************************************************************************** 78// 79// The following are values that can be passed to USBIntEnableEndpoint() and 80// USBIntDisableEndpoint() as the ui32Flags parameter, and are returned from 81// USBIntStatusEndpoint(). 82// 83//***************************************************************************** 84#define USB_INTEP_ALL 0xFFFFFFFF // Host IN Interrupts 85#define USB_INTEP_HOST_IN 0xFFFE0000 // Host IN Interrupts 86#define USB_INTEP_HOST_IN_15 0x80000000 // Endpoint 15 Host IN Interrupt 87#define USB_INTEP_HOST_IN_14 0x40000000 // Endpoint 14 Host IN Interrupt 88#define USB_INTEP_HOST_IN_13 0x20000000 // Endpoint 13 Host IN Interrupt 89#define USB_INTEP_HOST_IN_12 0x10000000 // Endpoint 12 Host IN Interrupt 90#define USB_INTEP_HOST_IN_11 0x08000000 // Endpoint 11 Host IN Interrupt 91#define USB_INTEP_HOST_IN_10 0x04000000 // Endpoint 10 Host IN Interrupt 92#define USB_INTEP_HOST_IN_9 0x02000000 // Endpoint 9 Host IN Interrupt 93#define USB_INTEP_HOST_IN_8 0x01000000 // Endpoint 8 Host IN Interrupt 94#define USB_INTEP_HOST_IN_7 0x00800000 // Endpoint 7 Host IN Interrupt 95#define USB_INTEP_HOST_IN_6 0x00400000 // Endpoint 6 Host IN Interrupt 96#define USB_INTEP_HOST_IN_5 0x00200000 // Endpoint 5 Host IN Interrupt 97#define USB_INTEP_HOST_IN_4 0x00100000 // Endpoint 4 Host IN Interrupt 98#define USB_INTEP_HOST_IN_3 0x00080000 // Endpoint 3 Host IN Interrupt 99#define USB_INTEP_HOST_IN_2 0x00040000 // Endpoint 2 Host IN Interrupt 100#define USB_INTEP_HOST_IN_1 0x00020000 // Endpoint 1 Host IN Interrupt 101 102#define USB_INTEP_DEV_OUT 0xFFFE0000 // Device OUT Interrupts 103#define USB_INTEP_DEV_OUT_15 0x80000000 // Endpoint 15 Device OUT Interrupt 104#define USB_INTEP_DEV_OUT_14 0x40000000 // Endpoint 14 Device OUT Interrupt 105#define USB_INTEP_DEV_OUT_13 0x20000000 // Endpoint 13 Device OUT Interrupt 106#define USB_INTEP_DEV_OUT_12 0x10000000 // Endpoint 12 Device OUT Interrupt 107#define USB_INTEP_DEV_OUT_11 0x08000000 // Endpoint 11 Device OUT Interrupt 108#define USB_INTEP_DEV_OUT_10 0x04000000 // Endpoint 10 Device OUT Interrupt 109#define USB_INTEP_DEV_OUT_9 0x02000000 // Endpoint 9 Device OUT Interrupt 110#define USB_INTEP_DEV_OUT_8 0x01000000 // Endpoint 8 Device OUT Interrupt 111#define USB_INTEP_DEV_OUT_7 0x00800000 // Endpoint 7 Device OUT Interrupt 112#define USB_INTEP_DEV_OUT_6 0x00400000 // Endpoint 6 Device OUT Interrupt 113#define USB_INTEP_DEV_OUT_5 0x00200000 // Endpoint 5 Device OUT Interrupt 114#define USB_INTEP_DEV_OUT_4 0x00100000 // Endpoint 4 Device OUT Interrupt 115#define USB_INTEP_DEV_OUT_3 0x00080000 // Endpoint 3 Device OUT Interrupt 116#define USB_INTEP_DEV_OUT_2 0x00040000 // Endpoint 2 Device OUT Interrupt 117#define USB_INTEP_DEV_OUT_1 0x00020000 // Endpoint 1 Device OUT Interrupt 118 119#define USB_INTEP_HOST_OUT 0x0000FFFE // Host OUT Interrupts 120#define USB_INTEP_HOST_OUT_15 0x00008000 // Endpoint 15 Host OUT Interrupt 121#define USB_INTEP_HOST_OUT_14 0x00004000 // Endpoint 14 Host OUT Interrupt 122#define USB_INTEP_HOST_OUT_13 0x00002000 // Endpoint 13 Host OUT Interrupt 123#define USB_INTEP_HOST_OUT_12 0x00001000 // Endpoint 12 Host OUT Interrupt 124#define USB_INTEP_HOST_OUT_11 0x00000800 // Endpoint 11 Host OUT Interrupt 125#define USB_INTEP_HOST_OUT_10 0x00000400 // Endpoint 10 Host OUT Interrupt 126#define USB_INTEP_HOST_OUT_9 0x00000200 // Endpoint 9 Host OUT Interrupt 127#define USB_INTEP_HOST_OUT_8 0x00000100 // Endpoint 8 Host OUT Interrupt 128#define USB_INTEP_HOST_OUT_7 0x00000080 // Endpoint 7 Host OUT Interrupt 129#define USB_INTEP_HOST_OUT_6 0x00000040 // Endpoint 6 Host OUT Interrupt 130#define USB_INTEP_HOST_OUT_5 0x00000020 // Endpoint 5 Host OUT Interrupt 131#define USB_INTEP_HOST_OUT_4 0x00000010 // Endpoint 4 Host OUT Interrupt 132#define USB_INTEP_HOST_OUT_3 0x00000008 // Endpoint 3 Host OUT Interrupt 133#define USB_INTEP_HOST_OUT_2 0x00000004 // Endpoint 2 Host OUT Interrupt 134#define USB_INTEP_HOST_OUT_1 0x00000002 // Endpoint 1 Host OUT Interrupt 135 136#define USB_INTEP_DEV_IN 0x0000FFFE // Device IN Interrupts 137#define USB_INTEP_DEV_IN_15 0x00008000 // Endpoint 15 Device IN Interrupt 138#define USB_INTEP_DEV_IN_14 0x00004000 // Endpoint 14 Device IN Interrupt 139#define USB_INTEP_DEV_IN_13 0x00002000 // Endpoint 13 Device IN Interrupt 140#define USB_INTEP_DEV_IN_12 0x00001000 // Endpoint 12 Device IN Interrupt 141#define USB_INTEP_DEV_IN_11 0x00000800 // Endpoint 11 Device IN Interrupt 142#define USB_INTEP_DEV_IN_10 0x00000400 // Endpoint 10 Device IN Interrupt 143#define USB_INTEP_DEV_IN_9 0x00000200 // Endpoint 9 Device IN Interrupt 144#define USB_INTEP_DEV_IN_8 0x00000100 // Endpoint 8 Device IN Interrupt 145#define USB_INTEP_DEV_IN_7 0x00000080 // Endpoint 7 Device IN Interrupt 146#define USB_INTEP_DEV_IN_6 0x00000040 // Endpoint 6 Device IN Interrupt 147#define USB_INTEP_DEV_IN_5 0x00000020 // Endpoint 5 Device IN Interrupt 148#define USB_INTEP_DEV_IN_4 0x00000010 // Endpoint 4 Device IN Interrupt 149#define USB_INTEP_DEV_IN_3 0x00000008 // Endpoint 3 Device IN Interrupt 150#define USB_INTEP_DEV_IN_2 0x00000004 // Endpoint 2 Device IN Interrupt 151#define USB_INTEP_DEV_IN_1 0x00000002 // Endpoint 1 Device IN Interrupt 152 153#define USB_INTEP_0 0x00000001 // Endpoint 0 Interrupt 154 155//***************************************************************************** 156// 157// The following are values that are returned from USBSpeedGet(). 158// 159//***************************************************************************** 160#define USB_UNDEF_SPEED 0x80000000 // Current speed is undefined 161#define USB_HIGH_SPEED 0x00000002 // Current speed is High Speed 162#define USB_FULL_SPEED 0x00000001 // Current speed is Full Speed 163#define USB_LOW_SPEED 0x00000000 // Current speed is Low Speed 164 165//***************************************************************************** 166// 167// The following are values that are returned from USBEndpointStatus(). The 168// USB_HOST_* values are used when the USB controller is in host mode and the 169// USB_DEV_* values are used when the USB controller is in device mode. 170// 171//***************************************************************************** 172#define USB_HOST_IN_STATUS 0x114F0000 // Mask of all host IN interrupts 173#define USB_HOST_IN_PID_ERROR 0x10000000 // Stall on this endpoint received 174#define USB_HOST_IN_NOT_COMP 0x01000000 // Device failed to respond 175#define USB_HOST_IN_STALL 0x00400000 // Stall on this endpoint received 176#define USB_HOST_IN_DATA_ERROR \ 177 0x00080000 // CRC or bit-stuff error 178// (ISOC Mode) 179#define USB_HOST_IN_NAK_TO \ 180 0x00080000 // NAK received for more than the 181// specified timeout period 182#define USB_HOST_IN_ERROR \ 183 0x00040000 // Failed to communicate with a 184// device 185#define USB_HOST_IN_FIFO_FULL 0x00020000 // RX FIFO full 186#define USB_HOST_IN_PKTRDY 0x00010000 // Data packet ready 187#define USB_HOST_OUT_STATUS 0x000000A7 // Mask of all host OUT interrupts 188#define USB_HOST_OUT_NAK_TO \ 189 0x00000080 // NAK received for more than the 190// specified timeout period 191#define USB_HOST_OUT_NOT_COMP \ 192 0x00000080 // No response from device 193// (ISOC mode) 194#define USB_HOST_OUT_STALL 0x00000020 // Stall on this endpoint received 195#define USB_HOST_OUT_ERROR \ 196 0x00000004 // Failed to communicate with a 197// device 198#define USB_HOST_OUT_FIFO_NE 0x00000002 // TX FIFO is not empty 199#define USB_HOST_OUT_PKTPEND 0x00000001 // Transmit still being transmitted 200#define USB_HOST_EP0_NAK_TO \ 201 0x00000080 // NAK received for more than the 202// specified timeout period 203#define USB_HOST_EP0_STATUS 0x00000040 // This was a status packet 204#define USB_HOST_EP0_ERROR \ 205 0x00000010 // Failed to communicate with a 206// device 207#define USB_HOST_EP0_RX_STALL 0x00000004 // Stall on this endpoint received 208#define USB_HOST_EP0_RXPKTRDY 0x00000001 // Receive data packet ready 209#define USB_DEV_RX_PID_ERROR \ 210 0x01000000 // PID error in isochronous 211// transfer 212#define USB_DEV_RX_SENT_STALL 0x00400000 // Stall was sent on this endpoint 213#define USB_DEV_RX_DATA_ERROR 0x00080000 // CRC error on the data 214#define USB_DEV_RX_OVERRUN \ 215 0x00040000 // OUT packet was not loaded due to 216// a full FIFO 217#define USB_DEV_RX_FIFO_FULL 0x00020000 // RX FIFO full 218#define USB_DEV_RX_PKT_RDY 0x00010000 // Data packet ready 219#define USB_DEV_TX_NOT_COMP \ 220 0x00000080 // Large packet split up, more data 221// to come 222#define USB_DEV_TX_SENT_STALL 0x00000020 // Stall was sent on this endpoint 223#define USB_DEV_TX_UNDERRUN 0x00000004 // IN received with no data ready 224#define USB_DEV_TX_FIFO_NE 0x00000002 // The TX FIFO is not empty 225#define USB_DEV_TX_TXPKTRDY 0x00000001 // Transmit still being transmitted 226#define USB_DEV_EP0_SETUP_END \ 227 0x00000010 // Control transaction ended before 228// Data End seen 229#define USB_DEV_EP0_SENT_STALL 0x00000004 // Stall was sent on this endpoint 230#define USB_DEV_EP0_IN_PKTPEND 0x00000002 // Transmit data packet pending 231#define USB_DEV_EP0_OUT_PKTRDY 0x00000001 // Receive data packet ready 232 233//***************************************************************************** 234// 235// The following are values that can be passed to USBHostEndpointConfig() and 236// USBDevEndpointConfigSet() as the ui32Flags parameter. 237// 238//***************************************************************************** 239#define USB_EP_AUTO_SET 0x00000001 // Auto set feature enabled 240#define USB_EP_AUTO_REQUEST 0x00000002 // Auto request feature enabled 241#define USB_EP_AUTO_CLEAR 0x00000004 // Auto clear feature enabled 242#define USB_EP_DMA_MODE_0 0x00000008 // Enable DMA access using mode 0 243#define USB_EP_DMA_MODE_1 0x00000010 // Enable DMA access using mode 1 244#define USB_EP_DIS_NYET \ 245 0x00000020 // Disable NYET response for 246// high-speed Bulk and Interrupt 247// endpoints in device mode. 248#define USB_EP_MODE_ISOC 0x00000000 // Isochronous endpoint 249#define USB_EP_MODE_BULK 0x00000100 // Bulk endpoint 250#define USB_EP_MODE_INT 0x00000200 // Interrupt endpoint 251#define USB_EP_MODE_CTRL 0x00000300 // Control endpoint 252#define USB_EP_MODE_MASK 0x00000300 // Mode Mask 253#define USB_EP_SPEED_LOW 0x00000000 // Low Speed 254#define USB_EP_SPEED_FULL 0x00001000 // Full Speed 255#define USB_EP_SPEED_HIGH 0x00004000 // High Speed 256#define USB_EP_HOST_IN 0x00000000 // Host IN endpoint 257#define USB_EP_HOST_OUT 0x00002000 // Host OUT endpoint 258#define USB_EP_DEV_IN 0x00002000 // Device IN endpoint 259#define USB_EP_DEV_OUT 0x00000000 // Device OUT endpoint 260 261//***************************************************************************** 262// 263// The following are values that can be passed to USBHostPwrConfig() as the 264// ui32Flags parameter. 265// 266//***************************************************************************** 267#define USB_HOST_PWRFLT_LOW 0x00000010 268#define USB_HOST_PWRFLT_HIGH 0x00000030 269#define USB_HOST_PWRFLT_EP_NONE 0x00000000 270#define USB_HOST_PWRFLT_EP_TRI 0x00000140 271#define USB_HOST_PWRFLT_EP_LOW 0x00000240 272#define USB_HOST_PWRFLT_EP_HIGH 0x00000340 273#define USB_HOST_PWREN_MAN_LOW 0x00000000 274#define USB_HOST_PWREN_MAN_HIGH 0x00000001 275#define USB_HOST_PWREN_AUTOLOW 0x00000002 276#define USB_HOST_PWREN_AUTOHIGH 0x00000003 277#define USB_HOST_PWREN_FILTER 0x00010000 278 279//***************************************************************************** 280// 281// The following are the valid values that can be passed to the 282// USBHostLPMConfig() function in the ui32Config parameter. 283// 284//***************************************************************************** 285#define USB_HOST_LPM_RMTWAKE 0x00000100 286#define USB_HOST_LPM_L1 0x00000001 287 288//***************************************************************************** 289// 290// The following are the valid values that can be passed to the 291// USBDevLPMConfig() function in the ui32Config parameter. 292// 293//***************************************************************************** 294#define USB_DEV_LPM_NAK 0x00000010 295#define USB_DEV_LPM_NONE 0x00000000 296#define USB_DEV_LPM_EN 0x0000000c 297#define USB_DEV_LPM_EXTONLY 0x00000004 298 299//***************************************************************************** 300// 301// The following are the valid values that are returned from the 302// USBLPMLinkStateGet() function. 303// 304//***************************************************************************** 305#define USB_DEV_LPM_LS_RMTWAKE 0x00000100 306#define USB_DEV_LPM_LS_L1 0x00000001 307 308//***************************************************************************** 309// 310// The following are the valid values that are passed to the USBLPMIntEnable() 311// or USBLPMIntDisable() functions or are returned from the USBLPMIntStatus() 312// function. 313// 314//***************************************************************************** 315#define USB_INTLPM_ERROR 0x00000020 316#define USB_INTLPM_RESUME 0x00000010 317#define USB_INTLPM_INCOMPLETE 0x00000008 318#define USB_INTLPM_ACK 0x00000004 319#define USB_INTLPM_NYET 0x00000002 320#define USB_INTLPM_STALL 0x00000001 321 322//***************************************************************************** 323// 324// The following are the valid values that are passed to the USBClockEnable() 325// functions. 326// 327//***************************************************************************** 328#define USB_CLOCK_INTERNAL 0x00000200 329#define USB_CLOCK_EXTERNAL 0x00000300 330 331//***************************************************************************** 332// 333// The configuration options used with the USBULPIConfig() API. 334// 335//***************************************************************************** 336#define USB_ULPI_EXTVBUS 0x00000001 337#define USB_ULPI_EXTVBUS_IND 0x00000002 338 339//***************************************************************************** 340// 341// The following are special values that can be passed to 342// USBHostEndpointConfig() as the ui32NAKPollInterval parameter. 343// 344//***************************************************************************** 345#define MAX_NAK_LIMIT 31 // Maximum NAK interval 346#define DISABLE_NAK_LIMIT 0 // No NAK timeouts 347 348//***************************************************************************** 349// 350// This value specifies the maximum size of transfers on endpoint 0 as 64 351// bytes. This value is fixed in hardware as the FIFO size for endpoint 0. 352// 353//***************************************************************************** 354#define MAX_PACKET_SIZE_EP0 64 355 356//***************************************************************************** 357// 358// These values are used to indicate which endpoint to access. 359// 360//***************************************************************************** 361#define USB_EP_0 0x00000000 // Endpoint 0 362#define USB_EP_1 0x00000010 // Endpoint 1 363#define USB_EP_2 0x00000020 // Endpoint 2 364#define USB_EP_3 0x00000030 // Endpoint 3 365#define USB_EP_4 0x00000040 // Endpoint 4 366#define USB_EP_5 0x00000050 // Endpoint 5 367#define USB_EP_6 0x00000060 // Endpoint 6 368#define USB_EP_7 0x00000070 // Endpoint 7 369#define NUM_USB_EP 8 // Number of supported endpoints 370 371//***************************************************************************** 372// 373// These macros allow conversion between 0-based endpoint indices and the 374// USB_EP_x values required when calling various USB APIs. 375// 376//***************************************************************************** 377#define IndexToUSBEP (x ) ((x) << 4) 378#define USBEPToIndex (x ) ((x) >> 4) 379 380//***************************************************************************** 381// 382// The following are values that can be passed to USBFIFOConfigSet() as the 383// ui32FIFOSize parameter. 384// 385//***************************************************************************** 386#define USB_FIFO_SZ_8 0x00000000 // 8 byte FIFO 387#define USB_FIFO_SZ_16 0x00000001 // 16 byte FIFO 388#define USB_FIFO_SZ_32 0x00000002 // 32 byte FIFO 389#define USB_FIFO_SZ_64 0x00000003 // 64 byte FIFO 390#define USB_FIFO_SZ_128 0x00000004 // 128 byte FIFO 391#define USB_FIFO_SZ_256 0x00000005 // 256 byte FIFO 392#define USB_FIFO_SZ_512 0x00000006 // 512 byte FIFO 393#define USB_FIFO_SZ_1024 0x00000007 // 1024 byte FIFO 394#define USB_FIFO_SZ_2048 0x00000008 // 2048 byte FIFO 395 396//***************************************************************************** 397// 398// This macro allow conversion from a FIFO size label as defined above to 399// a number of bytes 400// 401//***************************************************************************** 402#define USBFIFOSizeToBytes (x ) (8 << (x)) 403 404//***************************************************************************** 405// 406// The following are values that can be passed to USBEndpointDataSend() as the 407// ui32TransType parameter. 408// 409//***************************************************************************** 410#define USB_TRANS_OUT 0x00000102 // Normal OUT transaction 411#define USB_TRANS_IN 0x00000102 // Normal IN transaction 412#define USB_TRANS_IN_LAST \ 413 0x0000010a // Final IN transaction (for 414// endpoint 0 in device mode) 415#define USB_TRANS_SETUP \ 416 0x0000110a // Setup transaction (for endpoint 417// 0) 418#define USB_TRANS_STATUS \ 419 0x00000142 // Status transaction (for endpoint 420// 0) 421 422//***************************************************************************** 423// 424// The following are values are returned by the USBModeGet function. 425// 426//***************************************************************************** 427#define USB_DUAL_MODE_HOST \ 428 0x00000001 // Dual mode controller is in Host 429// mode. 430#define USB_DUAL_MODE_DEVICE \ 431 0x00000081 // Dual mode controller is in 432// Device mode. 433#define USB_DUAL_MODE_NONE \ 434 0x00000080 // Dual mode controller mode is not 435// set. 436#define USB_OTG_MODE_ASIDE_HOST \ 437 0x0000001d // OTG controller on the A side of 438// the cable. 439#define USB_OTG_MODE_ASIDE_NPWR \ 440 0x00000001 // OTG controller on the A side of 441// the cable. 442#define USB_OTG_MODE_ASIDE_SESS \ 443 0x00000009 // OTG controller on the A side of 444// the cable Session Valid. 445#define USB_OTG_MODE_ASIDE_AVAL \ 446 0x00000011 // OTG controller on the A side of 447// the cable A valid. 448#define USB_OTG_MODE_ASIDE_DEV \ 449 0x00000019 // OTG controller on the A side of 450// the cable. 451#define USB_OTG_MODE_BSIDE_HOST \ 452 0x0000009d // OTG controller on the B side of 453// the cable. 454#define USB_OTG_MODE_BSIDE_DEV \ 455 0x00000099 // OTG controller on the B side of 456// the cable. 457#define USB_OTG_MODE_BSIDE_NPWR \ 458 0x00000081 // OTG controller on the B side of 459// the cable. 460#define USB_OTG_MODE_NONE 0x00000080 // OTG controller mode is not set. 461 462//***************************************************************************** 463// 464// The values for the USBDMAChannelIntEnable() and USBDMAChannelIntStatus() 465// APIs. 466// 467//***************************************************************************** 468#define USB_DMA_INT_CH8 0x00000080 469#define USB_DMA_INT_CH7 0x00000040 470#define USB_DMA_INT_CH6 0x00000020 471#define USB_DMA_INT_CH5 0x00000010 472#define USB_DMA_INT_CH4 0x00000008 473#define USB_DMA_INT_CH3 0x00000004 474#define USB_DMA_INT_CH2 0x00000002 475#define USB_DMA_INT_CH1 0x00000001 476 477//***************************************************************************** 478// 479// The values for the USBDMAChannelStatus() API. 480// 481//***************************************************************************** 482#define USB_DMA_STATUS_ERROR 0x00000100 483 484//***************************************************************************** 485// 486// The valid return values for the USBControllerVersion() API. 487// 488//***************************************************************************** 489#define USB_CONTROLLER_VER_0 \ 490 0x00000000 // This is for Blizzard class 491// devices. 492#define USB_CONTROLLER_VER_1 \ 493 0x00000001 // This is for Snowflake class 494// devices. 495 496//***************************************************************************** 497// 498// The valid return values for the USBDMAModeSet() and USBDMAModeGet() APIs or 499// USBDMAChannelConfig(). 500// 501//***************************************************************************** 502#define USB_DMA_CFG_BURST_NONE 0x00000000 503#define USB_DMA_CFG_BURST_4 0x00000200 504#define USB_DMA_CFG_BURST_8 0x00000400 505#define USB_DMA_CFG_BURST_16 0x00000600 506#define USB_DMA_CFG_INT_EN 0x00000008 507#define USB_DMA_CFG_MODE_0 0x00000000 508#define USB_DMA_CFG_MODE_1 0x00000004 509#define USB_DMA_CFG_DIR_RX 0x00000000 510#define USB_DMA_CFG_DIR_TX 0x00000002 511#define USB_DMA_CFG_EN 0x00000001 512 513//***************************************************************************** 514// 515// The following are values that can be passed to USBModeConfig() as the 516// ui3Mode parameter. 517// 518//***************************************************************************** 519#define USB_MODE_HOST_VBUS 0x00000004 520#define USB_MODE_HOST 0x00000002 521#define USB_MODE_DEV_VBUS 0x00000005 522#define USB_MODE_DEV 0x00000003 523#define USB_MODE_OTG 0x00000000 524 525//***************************************************************************** 526// 527// Prototypes for the APIs. 528// 529//***************************************************************************** 530extern uint32_t USBDevAddrGet (uint32_t ui32Base ); 531extern void USBDevAddrSet (uint32_t ui32Base ,uint32_t ui32Address ); 532extern void USBDevConnect (uint32_t ui32Base ); 533extern void USBDevDisconnect (uint32_t ui32Base ); 534extern void USBDevEndpointConfigSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 535uint32_t ui32MaxPacketSize , 536uint32_t ui32Flags ); 537extern void USBDevEndpointConfigGet (uint32_t ui32Base ,uint32_t ui32Endpoint , 538uint32_t * pui32MaxPacketSize , 539uint32_t * pui32Flags ); 540extern void USBDevEndpointDataAck (uint32_t ui32Base ,uint32_t ui32Endpoint , 541bool bIsLastPacket ); 542extern void USBDevEndpointStall (uint32_t ui32Base ,uint32_t ui32Endpoint , 543uint32_t ui32Flags ); 544extern void USBDevEndpointStallClear (uint32_t ui32Base ,uint32_t ui32Endpoint , 545uint32_t ui32Flags ); 546extern void USBDevEndpointStatusClear (uint32_t ui32Base ,uint32_t ui32Endpoint , 547uint32_t ui32Flags ); 548extern uint32_t USBEndpointDataAvail (uint32_t ui32Base ,uint32_t ui32Endpoint ); 549extern void USBEndpointDMAEnable (uint32_t ui32Base ,uint32_t ui32Endpoint , 550uint32_t ui32Flags ); 551extern void USBEndpointDMADisable (uint32_t ui32Base ,uint32_t ui32Endpoint , 552uint32_t ui32Flags ); 553extern void USBEndpointDMAConfigSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 554uint32_t ui32Config ); 555extern int32_t USBEndpointDataGet (uint32_t ui32Base ,uint32_t ui32Endpoint , 556uint8_t * pui8Data ,uint32_t * pui32Size ); 557extern int32_t USBEndpointDataPut (uint32_t ui32Base ,uint32_t ui32Endpoint , 558uint8_t * pui8Data ,uint32_t ui32Size ); 559extern int32_t USBEndpointDataSend (uint32_t ui32Base ,uint32_t ui32Endpoint , 560uint32_t ui32TransType ); 561extern void USBEndpointDataToggleClear (uint32_t ui32Base ,uint32_t ui32Endpoint , 562uint32_t ui32Flags ); 563extern void USBEndpointPacketCountSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 564uint32_t ui32Count ); 565extern uint32_t USBEndpointStatus (uint32_t ui32Base ,uint32_t ui32Endpoint ); 566extern uint32_t USBFIFOAddrGet (uint32_t ui32Base ,uint32_t ui32Endpoint ); 567extern void USBFIFOConfigGet (uint32_t ui32Base ,uint32_t ui32Endpoint , 568uint32_t * pui32FIFOAddress , 569uint32_t * pui32FIFOSize ,uint32_t ui32Flags ); 570extern void USBFIFOConfigSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 571uint32_t ui32FIFOAddress ,uint32_t ui32FIFOSize , 572uint32_t ui32Flags ); 573extern void USBFIFOFlush (uint32_t ui32Base ,uint32_t ui32Endpoint , 574uint32_t ui32Flags ); 575extern uint32_t USBFrameNumberGet (uint32_t ui32Base ); 576extern uint32_t USBHostAddrGet (uint32_t ui32Base ,uint32_t ui32Endpoint , 577uint32_t ui32Flags ); 578extern void USBHostAddrSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 579uint32_t ui32Addr ,uint32_t ui32Flags ); 580extern void USBHostEndpointConfig (uint32_t ui32Base ,uint32_t ui32Endpoint , 581uint32_t ui32MaxPacketSize , 582uint32_t ui32NAKPollInterval , 583uint32_t ui32TargetEndpoint , 584uint32_t ui32Flags ); 585extern void USBHostEndpointDataAck (uint32_t ui32Base ,uint32_t ui32Endpoint ); 586extern void USBHostEndpointDataToggle (uint32_t ui32Base ,uint32_t ui32Endpoint , 587bool bDataToggle ,uint32_t ui32Flags ); 588extern void USBHostEndpointStatusClear (uint32_t ui32Base ,uint32_t ui32Endpoint , 589uint32_t ui32Flags ); 590extern uint32_t USBHostHubAddrGet (uint32_t ui32Base ,uint32_t ui32Endpoint , 591uint32_t ui32Flags ); 592extern void USBHostHubAddrSet (uint32_t ui32Base ,uint32_t ui32Endpoint , 593uint32_t ui32Addr ,uint32_t ui32Flags ); 594extern void USBHostPwrDisable (uint32_t ui32Base ); 595extern void USBHostPwrEnable (uint32_t ui32Base ); 596extern void USBHostPwrConfig (uint32_t ui32Base ,uint32_t ui32Flags ); 597extern void USBHostPwrFaultDisable (uint32_t ui32Base ); 598extern void USBHostPwrFaultEnable (uint32_t ui32Base ); 599extern void USBHostRequestIN (uint32_t ui32Base ,uint32_t ui32Endpoint ); 600extern void USBHostRequestINClear (uint32_t ui32Base ,uint32_t ui32Endpoint ); 601extern void USBHostRequestStatus (uint32_t ui32Base ); 602extern void USBHostReset (uint32_t ui32Base ,bool bStart ); 603extern void USBHostResume (uint32_t ui32Base ,bool bStart ); 604extern uint32_t USBHostSpeedGet (uint32_t ui32Base ); 605extern void USBHostSuspend (uint32_t ui32Base ); 606extern void USBIntDisableControl (uint32_t ui32Base ,uint32_t ui32IntFlags ); 607extern void USBIntEnableControl (uint32_t ui32Base ,uint32_t ui32IntFlags ); 608extern uint32_t USBIntStatusControl (uint32_t ui32Base ); 609extern void USBIntDisableEndpoint (uint32_t ui32Base ,uint32_t ui32IntFlags ); 610extern void USBIntEnableEndpoint (uint32_t ui32Base ,uint32_t ui32IntFlags ); 611extern uint32_t USBIntStatusEndpoint (uint32_t ui32Base ); 612extern void USBIntRegister (uint32_t ui32Base ,void (* pfnHandler )(void )); 613extern void USBIntUnregister (uint32_t ui32Base ); 614extern void USBOTGSessionRequest (uint32_t ui32Base ,bool bStart ); 615extern uint32_t USBModeGet (uint32_t ui32Base ); 616extern void USBEndpointDMAChannel (uint32_t ui32Base ,uint32_t ui32Endpoint , 617uint32_t ui32Channel ); 618extern uint32_t USBControllerVersion (uint32_t ui32Base ); 619extern uint32_t USBDMAChannelIntStatus (uint32_t ui32Base ); 620extern void USBDMAChannelConfigSet (uint32_t ui32Base ,uint32_t ui32Channel , 621uint32_t ui32Endpoint ,uint32_t ui32Config ); 622extern void USBDMAChannelAddressSet (uint32_t ui32Base ,uint32_t ui32Channel , 623void * pvAddress ); 624extern void * USBDMAChannelAddressGet (uint32_t ui32Base ,uint32_t ui32Channel ); 625extern void USBDMAChannelCountSet (uint32_t ui32Base ,uint32_t ui32Count , 626uint32_t ui32Channel ); 627extern uint32_t USBDMAChannelCountGet (uint32_t ui32Base ,uint32_t ui32Channel ); 628extern uint32_t USBDMANumChannels (uint32_t ui32Base ); 629extern void USBDMAChannelAssign (uint32_t ui32Base ,uint32_t ui32Endpoint , 630uint32_t ui32Channel ,uint32_t ui32Flags ); 631extern void USBDMAChannelIntEnable (uint32_t ui32Base ,uint32_t ui32Channel ); 632extern void USBDMAChannelIntDisable (uint32_t ui32Base ,uint32_t ui32Channel ); 633extern void USBDMAChannelEnable (uint32_t ui32Base ,uint32_t ui32Channel ); 634extern void USBDMAChannelDisable (uint32_t ui32Base ,uint32_t ui32Channel ); 635extern uint32_t USBDMAChannelStatus (uint32_t ui32Base ,uint32_t ui32Channel ); 636extern void USBDMAChannelStatusClear (uint32_t ui32Base ,uint32_t ui32Channel , 637uint32_t ui32Status ); 638extern void USBHostEndpointSpeed (uint32_t ui32Base ,uint32_t ui32Endpoint , 639uint32_t ui32Flags ); 640extern void USBHostEndpointPing (uint32_t ui32Base ,uint32_t ui32Endpoint , 641bool bEnable ); 642extern void USBHostLPMSend (uint32_t ui32Base ,uint32_t ui32Address , 643uint32_t uiEndpoint ); 644extern void USBHostLPMConfig (uint32_t ui32Base ,uint32_t ui32ResumeTime , 645uint32_t ui32Config ); 646extern bool USBLPMRemoteWakeEnabled (uint32_t ui32Base ); 647extern void USBHostLPMResume (uint32_t ui32Base ); 648extern void USBDevLPMRemoteWake (uint32_t ui32Base ); 649extern void USBDevLPMConfig (uint32_t ui32Base ,uint32_t ui32Config ); 650extern void USBDevLPMEnable (uint32_t ui32Base ); 651extern void USBDevLPMDisable (uint32_t ui32Base ); 652extern uint32_t USBLPMLinkStateGet (uint32_t ui32Base ); 653extern uint32_t USBLPMEndpointGet (uint32_t ui32Base ); 654extern uint32_t USBLPMIntStatus (uint32_t ui32Base ); 655extern void USBLPMIntDisable (uint32_t ui32Base ,uint32_t ui32Ints ); 656extern void USBLPMIntEnable (uint32_t ui32Base ,uint32_t ui32Ints ); 657extern void USBHighSpeed (uint32_t ui32Base ,bool bEnable ); 658extern uint32_t USBDevSpeedGet (uint32_t ui32Base ); 659extern void USBClockEnable (uint32_t ui32Base ,uint32_t ui32Div , 660uint32_t ui32Flags ); 661extern void USBClockDisable (uint32_t ui32Base ); 662extern void USBULPIConfig (uint32_t ui32Base ,uint32_t ui32Config ); 663extern void USBULPIEnable (uint32_t ui32Base ); 664extern void USBULPIDisable (uint32_t ui32Base ); 665extern uint8_t USBULPIRegRead (uint32_t ui32Base ,uint8_t ui8Reg ); 666extern void USBULPIRegWrite (uint32_t ui32Base ,uint8_t ui8Reg ,uint8_t ui8Data ); 667extern void USBHostMode (uint32_t ui32Base ); 668extern void USBDevMode (uint32_t ui32Base ); 669extern void USBOTGMode (uint32_t ui32Base ); 670extern void USBModeConfig (uint32_t ui32Base ,uint32_t ui32Mode ); 671extern void USBPHYPowerOff (uint32_t ui32Base ); 672extern void USBPHYPowerOn (uint32_t ui32Base ); 673extern uint32_t USBNumEndpointsGet (uint32_t ui32Base ); 674 675//***************************************************************************** 676// 677// Mark the end of the C bindings section for C++ compilers. 678// 679//***************************************************************************** 680#ifdef __cplusplus 681} 682#endif 683 684#endif // __DRIVERLIB_USB_H__