| usbpsu Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xusb_ch9_storage.c File Reference

## Overview

This file contains the implementation of the Mass Storage specific chapter 9 code for the example.

      MODIFICATION HISTORY:

      Ver   Who  Date     Changes

      1.0   sg  06/06/16  First release
      1.4   BK  12/01/18  Renamed the file and added changes to have a common
                           example for all USB IPs.
      1.5   vak 03/25/19  Fixed incorrect data_alignment pragma directive for IAR

    *

## Functions
u32 | Usb_Ch9SetupDevDescReply (struct Usb_DevData *InstancePtr, u8 *BufPtr, u32 BufLen)
| This function returns the device descriptor for the device. More...
u32 | Usb_Ch9SetupCfgDescReply (struct Usb_DevData *InstancePtr, u8 *BufPtr, u32 BufLen)
| This function returns the configuration descriptor for the device. More...
u32 | Usb_Ch9SetupStrDescReply (struct Usb_DevData *InstancePtr, u8 *BufPtr, u32 BufLen, u8 Index)
| This function returns a string descriptor for the given index. More...
u32 | Usb_Ch9SetupBosDescReply (u8 *BufPtr, u32 BufLen)
| This function returns the BOS descriptor for the device. More...
s32 | Usb_SetConfiguration (struct Usb_DevData *InstancePtr, SetupPacket *Ctrl)
| Changes State of Core to USB configured State. More...
s32 | Usb_SetConfigurationApp (struct Usb_DevData *InstancePtr, SetupPacket *SetupData)
| This function is called by Chapter9 handler when SET_CONFIGURATION command is received from Host. More...

## Function Documentation

u32 Usb_Ch9SetupBosDescReply | ( | u8 * | BufPtr,
|  | u32 | BufLen
| ) |  |

This function returns the BOS descriptor for the device.

Parameters

  BufPtr | is the pointer to the buffer that is to be filled with the descriptor.
  BufLen | is the size of the provided buffer.

Returns
  Length of the descriptor in the buffer on success. 0 on error.

References __attribute__.

u32 Usb_Ch9SetupCfgDescReply | ( | struct Usb_DevData * | InstancePtr,
|  | u8 * | BufPtr,
|  | u32 | BufLen
| ) |  |

This function returns the configuration descriptor for the device.

Parameters

  InstancePtr | is a pointer to the Usb_DevData instance.
  BufPtr | is the pointer to the buffer that is to be filled with the descriptor.
  BufLen | is the size of the provided buffer.

Returns
  Length of the descriptor in the buffer on success. 0 on error.

References IsSuperSpeed(), and Status.

u32 Usb_Ch9SetupDevDescReply | ( | struct Usb_DevData * | InstancePtr,
|  | u8 * | BufPtr,
|  | u32 | BufLen
| ) |  |

This function returns the device descriptor for the device.

Parameters

  InstancePtr | is a pointer to the Usb_DevData instance.
  BufPtr | is pointer to the buffer that is to be filled with the descriptor.
  BufLen | is the size of the provided buffer.

Returns
  Length of the descriptor in the buffer on success. 0 on error.

References IsSuperSpeed(), and Status.

u32 Usb_Ch9SetupStrDescReply | ( | struct Usb_DevData * | InstancePtr,
|  | u8 * | BufPtr,
|  | u32 | BufLen,
|  | u8 | Index
| ) |  |

This function returns a string descriptor for the given index.

Parameters

  InstancePtr | is a pointer to the Usb_DevData instance.
  BufPtr | is a pointer to the buffer that is to be filled with the descriptor.
  BufLen | is the size of the provided buffer.
  Index | is the index of the string for which the descriptor is requested.

Returns
  Length of the descriptor in the buffer on success. 0 on error.

References IsSuperSpeed(), and Status.

s32 Usb_SetConfiguration | ( | struct Usb_DevData * | InstancePtr,
|  | SetupPacket * | Ctrl
| ) |  |

Changes State of Core to USB configured State.

Parameters

  InstancePtr | is a pointer to the Usb_DevData instance.
  Ctrl | is a pointer to the Setup packet data.

Returns
  XST_SUCCESS else XST_FAILURE

Note
  None.

References Usb_DevData::PrivateData, SetConfigDone(), and Usb_DevData::State.

s32 Usb_SetConfigurationApp | ( | struct Usb_DevData * | InstancePtr,
|  | SetupPacket * | SetupData
| ) |  |

This function is called by Chapter9 handler when SET_CONFIGURATION command is received from Host.

Parameters

  InstancePtr | is pointer to Usb_DevData instance.
  SetupData | is the setup packet received from Host.

Returns
  - XST_SUCCESS if successful,
  - XST_FAILURE if unsuccessful.

Note
  Non control endpoints must be enabled after SET_CONFIGURATION command since hardware clears all previously enabled endpoints except control endpoints when this command is received.

References Usb_DevData::PrivateData, SetConfigDone(), and Usb_DevData::Speed.