Atmel Software Framework

udc.c File Reference

USB Device Controller (UDC)

Copyright (c) 2009 - 2014 Atmel Corporation. All rights reserved.

#include "conf_usb.h"
#include "usb_protocol.h"
#include "udd.h"
#include "udc_desc.h"
#include "udi.h"
#include "udc.h"

Data Structures

struct  udc_string_desc_t
 USB device string descriptor Structure used to transfer ASCII strings to USB String descriptor structure. More...
 

Functions

static usb_conf_desc_t
UDC_DESC_STORAGE
udc_get_eof_conf (void)
 Returns a value to check the end of USB Configuration descriptor. More...
 
usb_iface_desc_t UDC_DESC_STORAGEudc_get_interface_desc (void)
 Returns a pointer on the current interface descriptor. More...
 
static bool udc_iface_disable (uint8_t iface_num)
 Disables an usb device interface (UDI) This routine call the UDI corresponding to interface number. More...
 
static bool udc_iface_enable (uint8_t iface_num, uint8_t setting_num)
 Enables an usb device interface (UDI) This routine calls the UDI corresponding to the interface and setting number. More...
 
bool udc_process_setup (void)
 Main routine to manage the USB SETUP request. More...
 
static bool udc_req_ep (void)
 Send the SETUP interface request to UDI. More...
 
static bool udc_req_iface (void)
 Send the SETUP interface request to UDI. More...
 
static bool udc_req_std_dev_clear_feature (void)
 Standard device request to change device status. More...
 
static bool udc_req_std_dev_get_configuration (void)
 Standard device request to get configuration number. More...
 
static bool udc_req_std_dev_get_descriptor (void)
 Standard device request to get descriptors about USB device. More...
 
static bool udc_req_std_dev_get_status (void)
 Standard device request to get device status. More...
 
static bool udc_req_std_dev_get_str_desc (void)
 Standard device request to get device string descriptor. More...
 
static bool udc_req_std_dev_set_address (void)
 Standard device request to set device address. More...
 
static bool udc_req_std_dev_set_configuration (void)
 Standard device request to enable a configuration. More...
 
static bool udc_req_std_dev_set_feature (void)
 Standard device request to set a feature. More...
 
static bool udc_req_std_iface_get_setting (void)
 Standard interface request to get the alternate setting number of an interface. More...
 
static bool udc_req_std_iface_set_setting (void)
 Standard interface request to set an alternate setting of an interface. More...
 
static bool udc_reqstd (void)
 Main routine to manage the standard USB SETUP request. More...
 
void udc_reset (void)
 Reset the current configuration of the USB device, This routines can be called by UDD when a RESET on the USB line occurs. More...
 
void udc_sof_notify (void)
 To signal that a SOF is occurred. More...
 
void udc_start (void)
 Start the USB Device stack. More...
 
void udc_stop (void)
 Stop the USB Device stack. More...
 
static bool udc_update_iface_desc (uint8_t iface_num, uint8_t setting_num)
 Search an interface descriptor This routine updates the internal pointer udc_ptr_iface. More...
 
static void udc_valid_address (void)
 Standard endpoint request to halt an endpoint. More...
 

Variables

Internal variables to manage the USB device
static le16_t udc_device_status
 Device status state (see enum usb_device_status in usb_protocol.h) More...
 
static uint8_t udc_num_configuration = 0
 Device Configuration number selected by the USB host. More...
 
static udc_config_speed_t
UDC_DESC_STORAGE
udc_ptr_conf
 Pointer on the selected speed device configuration. More...
 
static usb_iface_desc_t
UDC_DESC_STORAGE
udc_ptr_iface
 Pointer on interface descriptor used by SETUP request. More...
 

Internal structure to store the USB device main strings

#define USB_DEVICE_MANUFACTURE_NAME_SIZE   0
 USB device manufacture name storage String is allocated only if USB_DEVICE_MANUFACTURE_NAME is declared by usb application configuration. More...
 
#define USB_DEVICE_PRODUCT_NAME_SIZE   0
 USB device product name storage String is allocated only if USB_DEVICE_PRODUCT_NAME is declared by usb application configuration. More...
 
#define USB_DEVICE_SERIAL_NAME_SIZE   0
 Get USB device serial number. More...
 
static COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE
usb_str_lgid_desc_t 
udc_string_desc_languageid
 Language ID of USB device (US ID by default) More...
 
static COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE struct
udc_string_desc_t 
udc_string_desc