Software Drivers

xusbps.c File Reference

#include <stdio.h>
#include "xusbps.h"

Functions

int XUsbPs_CfgInitialize (XUsbPs *InstancePtr, const XUsbPs_Config *ConfigPtr, u32 VirtBaseAddress)
void XUsbPs_DeviceReset (XUsbPs *InstancePtr)
int XUsbPs_Reset (XUsbPs *InstancePtr)
int XUsbPs_Suspend (const XUsbPs *InstancePtr)
int XUsbPs_Resume (const XUsbPs *InstancePtr)
int XUsbPs_RequestHostResume (const XUsbPs *InstancePtr)
int XUsbPs_SetDeviceAddress (XUsbPs *InstancePtr, u8 Address)

Detailed Description

The XUsbPs driver. Functions in this file are the minimum required functions for this driver. See xusbps.h for a detailed description of the driver.

Note:
None.
 MODIFICATION HISTORY:
 Ver   Who  Date     Changes
 ----- ---- -------- --------------------------------------------------------
 1.00a jz  10/10/10 First release
 2.1   kpc 04/28/14 Removed ununsed functions
 

Function Documentation

int XUsbPs_CfgInitialize ( XUsbPs InstancePtr,
const XUsbPs_Config ConfigPtr,
u32  VirtBaseAddress 
)

This function initializes a XUsbPs instance/driver.

The initialization entails:

  • Initialize all members of the XUsbPs structure.
Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
ConfigPtr is a pointer to a XUsbPs_Config configuration structure. This structure will contain the requested configuration for the device. Typically, this is a local structure and the content of which will be copied into the configuration structure within XUsbPs.
VirtBaseAddress is the base address of the device. For systems with virtual memory, this address must be the virtual address of the device. For systems that do not support virtual memory this address should be the physical address of the device. For backwards compatibilty NULL may be passed in systems that do not support virtual memory (deprecated).
Returns:
  • XST_SUCCESS no errors occured.
  • XST_FAILURE an error occured during initialization.
Note:
After calling XUsbPs_CfgInitialize() the controller IS NOT READY for use. Before the controller can be used its DEVICE parameters must be configured. See xusbps.h for details.
void XUsbPs_DeviceReset ( XUsbPs InstancePtr  ) 

This function performs device reset, device is stopped at the end.

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Returns:
None.
Note:
None.
int XUsbPs_RequestHostResume ( const XUsbPs InstancePtr  ) 

USB Assert Resume

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Returns:
  • XST_SUCCESS if the USB device has Resumed successfully
  • XST_FAILURE on any error
Note:
None.
int XUsbPs_Reset ( XUsbPs InstancePtr  ) 

This function resets the USB device. All the configuration registers are reset to their default values. The function waits until the reset operation is complete or for a certain duration within which the reset operation is expected to be completed.

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Returns:
  • XST_SUCCESS Reset operation completed successfully.
  • XST_FAILURE Reset operation timed out.
Note:
None.
int XUsbPs_Resume ( const XUsbPs InstancePtr  ) 

USB Resume

If the USB controller is suspended, its operation is resumed when any non-idle signaling is received on its upstream facing port.

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Returns:
  • XST_SUCCESS if the USB device has Resumed successfully
  • XST_FAILURE on any error
Note:
None.
int XUsbPs_SetDeviceAddress ( XUsbPs InstancePtr,
u8  Address 
)

This functions sets the controller's DEVICE address. It also sets the advance bit so the controller will wait for the next IN-ACK before the new address takes effect.

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Address is the Address of the device.
Returns:
  • XST_SUCCESS: Address set successfully.
  • XST_FAILURE: An error occured.
  • XST_INVALID_PARAM: Invalid parameter passed, e.g. address value too big.
Note:
None.
int XUsbPs_Suspend ( const XUsbPs InstancePtr  ) 

USB Suspend

In order to conserve power, USB devices automatically enter the suspended state when the device has observed no bus traffic for a specified period. When suspended, the USB device maintains any internal status, including its address and configuration. Attached devices must be prepared to suspend at any time they are powered, regardless of if they have been assigned a non-default address, are configured, or neither. Bus activity may cease due to the host entering a suspend mode of its own. In addition, a USB device shall also enter the suspended state when the hub port it is attached to is disabled.

A USB device exits suspend mode when there is bus activity. A USB device may also request the host to exit suspend mode or selective suspend by using electrical signaling to indicate remote wakeup. The ability of a device to signal remote wakeup is optional. If the USB device is capable of remote wakeup signaling, the device must support the ability of the host to enable and disable this capability. When the device is reset, remote wakeup signaling must be disabled.

Parameters:
InstancePtr is a pointer to XUsbPs instance of the controller.
Returns:
  • XST_SUCCESS if the USB device has entered Suspend mode successfully
  • XST_FAILURE on any error
Note:
None.