# drivers/usb/udc_lib.c File Reference

USB Device Controller library functions. More...

`#include <byteorder.h>`
`#include <debug.h>`
`#include <usb/function.h>`
`#include <usb/udc.h>`
`#include <usb/usb_protocol.h>`

Include dependency graph for udc_lib.c:

Go to the source code of this file.

## Functions
int | udc_lib_process_setup_request (struct udc *udc, struct usb_setup_req *req)
| Handle a USB SETUP request.

## Detailed Description

USB Device Controller library functions.

This file contains various utility functions for use by UDC drivers.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices with a USB Device Controller
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file udc_lib.c.

## Function Documentation

int udc_lib_process_setup_request | ( | struct udc * | udc,
|  | struct usb_setup_req * | req |
| ) |  |  |

Handle a USB SETUP request.

This function parses a USB SETUP request and submits an appropriate response back to the host or, in the case of SETUP OUT requests with data, sets up a buffer for receiving the data payload.

Standard requests defined by the USB 2.0 standard are handled internaly, while class- and vendor-specific requests are passed on to the function driver.

Parameters:

  | udc | USB Device Controller instance.
  | req | The raw USB SETUP request.

Returns:
  0 if successful or a negative value if a STALL handshake should be sent as the response.

Definition at line 224 of file udc_lib.c.

References usb_setup_req::bmRequestType, usb_setup_req::bRequest, dbg_printf, usb_func_process_setup_request(), usb_setup_req::wIndex, usb_setup_req::wLength, and usb_setup_req::wValue.

Here is the call graph for this function: