usb: xusb_cp9.c File Reference

| usb Xilinx SDK Drivers API Documentation

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

Functions
xusb_cp9.c File Reference

## Overview

This file contains the USB Chapter 9 related functions.

Note
  None.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a hvm  2/22/07 First release
    1.01a hvm  5/30/07 Moved the USB class specific command processing to
                  application files.
    3.00a hvm  11/18/09 Updated to use HAL processor APIs.
                   XUsb_mReadReg is renamed to XUsb_ReadReg and
                   XUsb_mWriteReg is renamed to XUsb_WriteReg.
    3.02a hvm  08/16/10 Updated with the little endian support changes.
    4.00a hvm  12/20/10 Updated SetInterface function with microphone case
                    support.

## Functions
void | EP0ProcessOutToken (XUsb *InstancePtr)
| This routine is called when an OUT transaction for Endpoint Zero is received. More...
void | EP0ProcessInToken (XUsb *InstancePtr)
| This routine is called when IN transaction for Endpoint Zero is received. More...
int | Chapter9 (XUsb *InstancePtr)
| This routine is called when a chapter 9 command is received. More...
int | ExecuteCommand (XUsb *InstancePtr)
| This function executes the chapter 9 command processing. More...
void | GetInterface (XUsb *InstancePtr)
| This function responds to the GET_INTERFACE command. More...
void | SetInterface (XUsb *InstancePtr)
| This function responds to the SET_INTERFACE command. More...
void | SetupControlWriteStatusStage (XUsb *InstancePtr)
| This function sets the basic Control status words. More...
void | GetStatus (XUsb *InstancePtr)
| This routine is called when a GET_STATUS command is received. More...
void | GetDescriptor (XUsb *InstancePtr)
| This routine is called when a GET_DESCRIPTOR command is received. More...
void | SetDescriptor (XUsb *InstancePtr)
| This routine is called when a SET_DESCRIPTOR command is received. More...
void | GetConfiguration (XUsb *InstancePtr)
| This routine is called when a GET_CONFIGURATION command is received. More...
void | SetConfiguration (XUsb *InstancePtr)
| This routine is called when a SET_CONFIGURATION command is received. More...
void | SetClearFeature (XUsb *InstancePtr, int flag)
| This routine is called when a SET_FEATURE or a CLEAR_FEATURE command is received. More...
void | LoadEP0 (XUsb *InstancePtr)
| This routine copies the EP0 related data to the DPRAM. More...

## Function Documentation

int Chapter9 | ( | XUsb * | InstancePtr | ) |

This routine is called when a chapter 9 command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  The setup request value to be processed by the upper layer.

Note
  None.

References XUsb_Config::BaseAddress, XUsb::Config, ExecuteCommand(), and XUSB_SETUP_PKT_ADDR_OFFSET.

Referenced by Ep0IntrHandler().

void EP0ProcessInToken | ( | XUsb * | InstancePtr | ) |

This routine is called when IN transaction for Endpoint Zero is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb::DeviceConfig, XUsb::EndPointOffset, XUsb_DeviceConfig::Ep, LoadEP0(), TEST_J, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, XUSB_EP_CFG_DATA_TOGGLE_MASK, XUsb_ReadReg, XUsb_SetDeviceAddress(), XUsb_SetTestMode(), and XUsb_WriteReg.

Referenced by Ep0IntrHandler().

void EP0ProcessOutToken | ( | XUsb * | InstancePtr | ) |

This routine is called when an OUT transaction for Endpoint Zero is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, ExecuteCommand(), XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, XUsb_ReadReg, and XUsb_WriteReg.

Referenced by Ep0IntrHandler().

int ExecuteCommand | ( | XUsb * | InstancePtr | ) |

This function executes the chapter 9 command processing.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  The request value to be processed by the upper layer if the request is not handled. XST_SUCCESS if the request is successfully processed.

Note
  None.

References GetConfiguration(), GetDescriptor(), GetInterface(), GetStatus(), SetClearFeature(), SetConfiguration(), SetDescriptor(), SetInterface(), SetupControlWriteStatusStage(), and XUsb_EpStall().

Referenced by Chapter9(), and EP0ProcessOutToken().

void GetConfiguration | ( | XUsb * | InstancePtr | ) |

This routine is called when a GET_CONFIGURATION command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb_DeviceConfig::CurrentConfiguration, XUsb::DeviceConfig, XUsb::EndPointOffset, XUsb_DeviceConfig::Ep, XUsb_EpConfig::RamBase, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, and XUsb_WriteReg.

Referenced by ExecuteCommand().

void GetDescriptor | ( | XUsb * | InstancePtr | ) |

This routine is called when a GET_DESCRIPTOR command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_DeviceConfig::CurrentSpeed, XUsb::DeviceConfig, LoadEP0(), XUSB_EP_HIGH_SPEED, and XUsb_EpStall().

Referenced by ExecuteCommand().

void GetInterface | ( | XUsb * | InstancePtr | ) |

This function responds to the GET_INTERFACE command.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb::DeviceConfig, XUsb::EndPointOffset, XUsb_DeviceConfig::Ep, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, XUsb_EpStall(), and XUsb_WriteReg.

Referenced by ExecuteCommand().

void GetStatus | ( | XUsb * | InstancePtr | ) |

This routine is called when a GET_STATUS command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb::DeviceConfig, XUsb::EndPointOffset, XUsb_DeviceConfig::Ep, XUsb_EpConfig::RamBase, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, XUSB_EP_CFG_STALL_MASK, XUSB_EP_CFG_STALL_SHIFT, XUsb_EpStall(), XUsb_ReadReg, and XUsb_WriteReg.

Referenced by ExecuteCommand().

void LoadEP0 | ( | XUsb * | InstancePtr | ) |

This routine copies the EP0 related data to the DPRAM.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb::Config, XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, XUsb_EpConfig::RamBase, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, and XUsb_WriteReg.

Referenced by EP0ProcessInToken(), and GetDescriptor().

void SetClearFeature | ( | XUsb * | InstancePtr,
|  | int | flag
| ) |  |

This routine is called when a SET_FEATURE or a CLEAR_FEATURE command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.
  flag | specifies whether it is a SET_FEATURE (TRUE)or a CLEAR_FEATURE (FALSE) command.

Returns
  None.

Note
  None.

References XUsb::Config, XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, XUsb_EpConfig::OutIn, SetupControlWriteStatusStage(), XUSB_EP_CFG_DATA_TOGGLE_MASK, XUsb_EpStall(), XUsb_EpUnstall(), XUsb_ReadReg, and XUsb_WriteReg.

Referenced by ExecuteCommand().

void SetConfiguration | ( | XUsb * | InstancePtr | ) |

This routine is called when a SET_CONFIGURATION command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Ready, XUsb_EpConfig::Buffer1Ready, XUsb::Config, XUsb_DeviceConfig::CurrentConfiguration, XUsb::DeviceConfig, XUsb_DeviceConfig::Ep, InitUsbInterface(), XUsb_DeviceConfig::NumEndpoints, XUsb_EpConfig::OutIn, SetupControlWriteStatusStage(), XUSB_BUFFREADY_OFFSET, XUSB_EP_DIRECTION_OUT, XUsb_EpStall(), XUSB_STATUS_EP_BUFF2_SHIFT, and XUsb_WriteReg.

Referenced by ExecuteCommand().

void SetDescriptor | ( | XUsb * | InstancePtr | ) |

This routine is called when a SET_DESCRIPTOR command is received.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_EpStall().

Referenced by ExecuteCommand().

void SetInterface | ( | XUsb * | InstancePtr | ) |

This function responds to the SET_INTERFACE command.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References SetupControlWriteStatusStage(), and XUsb_EpStall().

Referenced by ExecuteCommand().

void SetupControlWriteStatusStage | ( | XUsb * | InstancePtr | ) |

This function sets the basic Control status words.

Parameters

  InstancePtr | is a pointer to the XUsb instance of the controller.

Returns
  None.

Note
  None.

References XUsb_Config::BaseAddress, XUsb_EpConfig::Buffer0Count, XUsb::Config, XUsb::DeviceConfig, XUsb::EndPointOffset, XUsb_DeviceConfig::Ep, XUSB_BUFFREADY_OFFSET, XUSB_EP_BUF0COUNT_OFFSET, XUSB_EP_CFG_DATA_TOGGLE_MASK, XUsb_ReadReg, and XUsb_WriteReg.

Referenced by ExecuteCommand(), MassStorageReset(), SetClearFeature(), SetConfiguration(), and SetInterface().