- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# usb_device_task.c File Reference

`#include "config.h"`
`#include "conf_usb.h"`
`#include "usb_device_task.h"`
`#include "modules/usb/usb_task.h"`
`#include "modules/usb/host_chap9/usb_host_task.h"`
`#include "lib_mcu/usb/usb_drv.h"`
`#include "usb_descriptors.h"`
`#include "modules/usb/device_chap9/usb_standard_request.h"`
`#include "lib_mcu/pll/pll_drv.h"`
`#include "lib_board/lcd/lcd_drv.h"`

Include dependency graph for usb_device_task.c:

Go to the source code of this file.

## Functions
void | usb_device_task_init (void)
void | usb_start_device (void)
void | usb_device_task (void)
## Variables
bit | usb_connected = FALSE
| Public : (bit) usb_connected usb_connected is set to TRUE when VBUS has been detected usb_connected is set to FALSE otherwise /.
bit | usb_suspended = FALSE
| Public : (bit) usb_suspended usb_suspended is set to TRUE when USB is in suspend mode usb_suspended is set to FALSE otherwise /.
U8 | usb_configuration_nb
| Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /.
U8 | otg_b_device_state
| Public : (U8) otg_b_device_state; Store the current state of the B-Device.
U8 | otg_device_sessions
| Public : (U8) otg_device_sessions; Store some events and conditions specifics to OTG Devices sessions.
U8 | otg_b_device_hnp
| Public : (U8) otg_b_device_hnp; Store some events and conditions specifics to OTG B-Device HNP protocol.
U16 | otg_tb_srp_cpt
| Public : (U16) otg_tb_srp_cpt; Counter used to signal a SRP fail condition (SRP fails if Tb_Srp_Fail elapsed).
U8 | sof_seen_in_session
| Public : (U8) sof_seen_in_session; Indicates if a SOF has been received during the current session /.

## Detailed Description

This file manages the USB device controller.

The USB task checks the income of new requests from the USB Host. When a Setup request occurs, this task will launch the processing of this setup contained in the usb_standard_request.c file. Other class specific requests are also processed in this file.

- Compiler: IAR EWAVR and GNU GCC for AVR
- Supported devices: AT90USB1287, AT90USB1286, AT90USB647, AT90USB646

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

Definition in file usb_device_task.c.

## Variable Documentation

bit usb_connected = FALSE

Public : (bit) usb_connected usb_connected is set to TRUE when VBUS has been detected usb_connected is set to FALSE otherwise /.

Public : (bit) usb_connected usb_connected is set to TRUE when VBUS has been detected usb_connected is set to FALSE otherwise Used with USB_DEVICE_FEATURE == ENABLED only /.

Definition at line 76 of file usb_device_task.c.

Referenced by usb_device_task().

U8 usb_configuration_nb

Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /.

Definition at line 97 of file usb_standard_request.c.

Referenced by usb_device_task(), usb_general_interrupt(), usb_get_configuration(), and usb_set_configuration().

U8 otg_b_device_hnp

Public : (U8) otg_b_device_hnp; Store some events and conditions specifics to OTG B-Device HNP protocol.

Definition at line 108 of file usb_device_task.c.