Atmel Software Framework

udi_api_t Struct Reference

UDI API.

The callbacks within this structure are called only by USB Device Controller (UDC)

The udc_get_interface_desc() can be use by UDI to know the interface descriptor selected by UDC.

#include <udi.h>

Data Fields

void(* disable )(void)
 Disable the interface. More...
 
bool(* enable )(void)
 Enable the interface. More...
 
uint8_t(* getsetting )(void)
 Returns the current setting of the selected interface. More...
 
bool(* setup )(void)
 Handle a control request directed at an interface. More...
 
void(* sof_notify )(void)
 To signal that a SOF is occurred. More...
 

void(* udi_api_t::disable)(void)

Disable the interface.

This function is called when this interface is currently active, and

  • the host selects any configuration through a Set Configuration request, or
  • the host issues a USB reset, or
  • the device is detached from the host (i.e. Vbus is no longer present)
bool(* udi_api_t::enable)(void)

Enable the interface.

This function is called when the host selects a configuration to which this interface belongs through a Set Configuration request, and when the host selects an alternate setting of this interface through a Set Interface request.

Returns
1 if function was successfully done, otherwise 0.

Referenced by udc_iface_enable().

uint8_t(* udi_api_t::getsetting)(void)

Returns the current setting of the selected interface.

This function is called when UDC when know alternate setting of selected interface.

Returns
alternate setting of selected interface

Referenced by udc_req_std_iface_get_setting().

bool(* udi_api_t::setup)(void)

Handle a control request directed at an interface.

This function is called when this interface is currently active and the host sends a SETUP request with this interface as the recipient.

Use udd_g_ctrlreq to decode and response to SETUP request.

Returns
1 if this interface supports the SETUP request, otherwise 0.

Referenced by udc_req_iface().

void(* udi_api_t::sof_notify)(void)

To signal that a SOF is occurred.

Referenced by udc_sof_notify().