EE445M RTOS
Taken at the University of Texas Spring 2015
Usb_ulpi

Functions

void USBULPIConfig (uint32_t ui32Base, uint32_t ui32Config)
 
void USBULPIEnable (uint32_t ui32Base)
 
void USBULPIDisable (uint32_t ui32Base)
 
uint8_t USBULPIRegRead (uint32_t ui32Base, uint8_t ui8Reg)
 
void USBULPIRegWrite (uint32_t ui32Base, uint8_t ui8Reg, uint8_t ui8Data)
 

Detailed Description

Function Documentation

void USBULPIConfig ( uint32_t  ui32Base,
uint32_t  ui32Config 
)

Configures the USB controller's ULPI function.

Parameters
ui32Basespecifies the USB module base address.
ui32Configcontains the configuration options.

This function is used to configure the USB controller's ULPI function. The configuration options are set in the ui32Config parameter and are a logical OR of the following values:

  • USB_ULPI_EXTVBUS enables the external ULPI PHY as the source for VBUS signaling.
  • USB_ULPI_EXTVBUS_IND enables the external ULPI PHY to detect external VBUS over-current condition.

Example: Enable ULPI PHY with full VBUS control.

//! //
//! // Enable ULPI PHY with full VBUS control.
//! //
//! USBULPIConfig(USB0_BASE, USB_ULPI_EXTVBUS | USB_ULPI_EXTVBUS_IND);
//! 
\note The USB ULPI feature is not available on all Tiva devices.
Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return None.  

Definition at line 4995 of file usb.c.

References HWREGB, and USB_O_ULPIVBUSCTL.

4996 {
4997  HWREGB(ui32Base + USB_O_ULPIVBUSCTL) = (uint8_t)ui32Config;
4998 }
#define HWREGB(x)
Definition: hw_types.h:52
#define USB_O_ULPIVBUSCTL
Definition: hw_usb.h:73
void USBULPIDisable ( uint32_t  ui32Base)

Disables the USB controller's ULPI function.

Parameters
ui32Basespecifies the USB module base address.

This function disables the USB controller's ULPI function. Accesses to the external ULPI-connected PHY cannot succeed after this function has been called.

Example: Disable ULPI function.

//! //
//! // Disable ULPI function.
//! //
//! USBULPIDisable(USB0_BASE);
//! 
\note The USB ULPI feature is not available on all Tiva devices.
Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return None.  

Definition at line 5058 of file usb.c.

References HWREG, USB_O_PC, and USB_PC_ULPIEN.

5059 {
5060  HWREG(ui32Base + USB_O_PC) &= ~USB_PC_ULPIEN;
5061 }
#define HWREG(x)
Definition: hw_types.h:48
#define USB_PC_ULPIEN
Definition: hw_usb.h:3020
#define USB_O_PC
Definition: hw_usb.h:405
void USBULPIEnable ( uint32_t  ui32Base)

Enables the USB controller's ULPI function.

Parameters
ui32Basespecifies the USB module base address.

This function enables the USB controller's ULPI function and must be called before attempting to access an external ULPI-connected USB PHY.

Example: Enable ULPI function.

//! //
//! // Enable ULPI function.
//! //
//! USBULPIEnable(USB0_BASE);
//! 
\note The USB ULPI feature is not available on all Tiva devices.
Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return None.  

Definition at line 5026 of file usb.c.

References HWREG, USB_O_PC, and USB_PC_ULPIEN.

5027 {
5028  HWREG(ui32Base + USB_O_PC) |= USB_PC_ULPIEN;
5029 }
#define HWREG(x)
Definition: hw_types.h:48
#define USB_PC_ULPIEN
Definition: hw_usb.h:3020
#define USB_O_PC
Definition: hw_usb.h:405
uint8_t USBULPIRegRead ( uint32_t  ui32Base,
uint8_t  ui8Reg 
)

Reads a register from an external ULPI-connected USB PHY.

Parameters
ui32Basespecifies the USB module base address.
ui8Regspecifies the register address to read.

This function reads the register address specified in the ui8Reg parameter using the ULPI function. This function is blocking and only returns when the read access completes. The function does not return if there is not a ULPI-connected USB PHY present.

Example: Read a register from the ULPI PHY.

//! uint8_t ui8Value;
//!
//! //
//! // Read a register from the ULPI PHY register at 0x10.
//! //
//! ui8Value = USBULPIRegRead(USB0_BASE, 0x10);
//! 
\note The USB ULPI feature is not available on all Tiva devices.
Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return The value of the requested ULPI register.  

Definition at line 5094 of file usb.c.

References ASSERT, HWREGB, USB0_BASE, USB_O_ULPIREGADDR, USB_O_ULPIREGCTL, USB_O_ULPIREGDATA, USB_ULPIREGCTL_RDWR, USB_ULPIREGCTL_REGACC, and USB_ULPIREGCTL_REGCMPLT.

5095 {
5096  ASSERT(ui32Base == USB0_BASE);
5097 
5098  //
5099  // Set the register address and initiate a read access.
5100  //
5101  HWREGB(ui32Base + USB_O_ULPIREGADDR) = ui8Reg;
5102  HWREGB(ui32Base + USB_O_ULPIREGCTL) =
5104 
5105  //
5106  // Wait for the access to complete.
5107  //
5108  while((HWREGB(ui32Base + USB_O_ULPIREGCTL) & USB_ULPIREGCTL_REGCMPLT) == 0)
5109  {
5110  }
5111 
5112  //
5113  // Clear the register access complete flag.
5114  //
5115  HWREGB(ui32Base + USB_O_ULPIREGCTL) = 0;
5116 
5117  return(HWREGB(ui32Base + USB_O_ULPIREGDATA));
5118 }
#define ASSERT(expr)
Definition: debug.h:67
#define USB_ULPIREGCTL_RDWR
Definition: hw_usb.h:725
#define USB_O_ULPIREGADDR
Definition: hw_usb.h:75
#define USB_O_ULPIREGDATA
Definition: hw_usb.h:74
#define USB_ULPIREGCTL_REGCMPLT
Definition: hw_usb.h:726
#define USB_O_ULPIREGCTL
Definition: hw_usb.h:76
#define USB_ULPIREGCTL_REGACC
Definition: hw_usb.h:727
#define HWREGB(x)
Definition: hw_types.h:52
#define USB0_BASE
Definition: hw_memmap.h:99
void USBULPIRegWrite ( uint32_t  ui32Base,
uint8_t  ui8Reg,
uint8_t  ui8Data 
)

Writes a value to a register on an external ULPI-connected USB PHY.

Parameters
ui32Basespecifies the USB module base address.
ui8Regspecifies the register address to write.
ui8Dataspecifies the data to write.

This function writes the register address specified in the ui8Reg parameter with the value specified in the ui8Data parameter using the ULPI function. This function is blocking and only returns when the write access completes. The function does not return if there is not a ULPI-connected USB PHY present.

Example: Write a register from the external ULPI PHY.

//! //
//! // Write the ULPI PHY register at 0x10 with 0x20.
//! //
//! USBULPIRegWrite(USB0_BASE, 0x10, 0x20);
//! 
\note The USB ULPI feature is not available on all Tiva devices.
Please consult the data sheet for the Tiva device that you
are using to determine if this feature is available.

\return None.  

Definition at line 5151 of file usb.c.

References ASSERT, HWREGB, USB0_BASE, USB_O_ULPIREGADDR, USB_O_ULPIREGCTL, USB_O_ULPIREGDATA, USB_ULPIREGCTL_REGACC, and USB_ULPIREGCTL_REGCMPLT.

5152 {
5153  ASSERT(ui32Base == USB0_BASE);
5154 
5155  //
5156  // Set the register address and initiate a read access.
5157  //
5158  HWREGB(ui32Base + USB_O_ULPIREGADDR) = ui8Reg;
5159  HWREGB(ui32Base + USB_O_ULPIREGDATA) = ui8Data;
5161 
5162  //
5163  // Wait for the access to complete.
5164  //
5165  while((HWREGB(ui32Base + USB_O_ULPIREGCTL) & USB_ULPIREGCTL_REGCMPLT) == 0)
5166  {
5167  }
5168 
5169  //
5170  // Clear the register access complete flag.
5171  //
5172  HWREGB(ui32Base + USB_O_ULPIREGCTL) = 0;
5173 }
#define ASSERT(expr)
Definition: debug.h:67
#define USB_O_ULPIREGADDR
Definition: hw_usb.h:75
#define USB_O_ULPIREGDATA
Definition: hw_usb.h:74
#define USB_ULPIREGCTL_REGCMPLT
Definition: hw_usb.h:726
#define USB_O_ULPIREGCTL
Definition: hw_usb.h:76
#define USB_ULPIREGCTL_REGACC
Definition: hw_usb.h:727
#define HWREGB(x)
Definition: hw_types.h:52
#define USB0_BASE
Definition: hw_memmap.h:99