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

# usb_task.h File Reference

`#include "modules/usb/usb_commun.h"`

Include dependency graph for usb_task.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | Usb_send_event(x) (g_usb_event |= (1<<x))
#define | Usb_ack_event(x) (g_usb_event &= ~(1<<x))
#define | Usb_clear_all_event() (g_usb_event = 0)
#define | Is_usb_event(x) ((g_usb_event & (1<<x)) ? TRUE : FALSE)
#define | Is_not_usb_event(x) ((g_usb_event & (1<<x)) ? FALSE: TRUE)
#define | Is_host_emergency_exit() (Is_usb_id_device())
#define | Is_usb_device() (g_usb_mode==USB_MODE_DEVICE ? TRUE : FALSE)
#define | Is_usb_host() (g_usb_mode==USB_MODE_HOST ? TRUE : FALSE)
#define | Otg_send_event(x) (g_otg_event |= (1<<x))
#define | Otg_ack_event(x) (g_otg_event &= ~(1<<x))
#define | Otg_clear_all_event() (g_otg_event = 0)
#define | Is_otg_event(x) ((g_otg_event & (1<<x)) ? TRUE : FALSE)
#define | Is_not_otg_event(x) ((g_otg_event & (1<<x)) ? FALSE: TRUE)
#define | EVT_USB_POWERED 1
#define | EVT_USB_UNPOWERED 2
#define | EVT_USB_DEVICE_FUNCTION 3
#define | EVT_USB_HOST_FUNCTION 4
#define | EVT_USB_SUSPEND 5
#define | EVT_USB_WAKE_UP 6
#define | EVT_USB_RESUME 7
#define | EVT_USB_RESET 8
#define | EVT_HOST_SOF 9
#define | EVT_HOST_HWUP 10
#define | EVT_HOST_DISCONNECTION 11
#define | EVT_HOST_REMOTE_WAKEUP 12
#define | EVT_OTG_HNP_ERROR 1
#define | EVT_OTG_HNP_SUCCESS 2
#define | EVT_OTG_SRP_RECEIVED 3
#define | EVT_OTG_DEV_UNSUPPORTED 4
#define | EVT_OTG_DEVICE_CONNECTED 5
#define | USB_MODE_UNDEFINED 0x00
#define | USB_MODE_HOST 0x01
#define | USB_MODE_DEVICE 0x02
#define | VBUS_PULSE 1
#define | DATA_PULSE 0
#define | BDEV_HNP_NB_RETRY 3
#define | USER_RQST_SRP 0x01
#define | USER_RQST_SUSPEND 0x02
#define | USER_RQST_VBUS 0x04
#define | USER_RQST_HNP 0x08
#define | USER_RQST_RESUME 0x10
#define | USER_RQST_RESET 0x20
#define | USER_RQST_DISCONNECT 0x40
#define | Is_user_requested_srp() (((otg_user_request&USER_RQST_SRP) != 0) ? TRUE : FALSE)
#define | Set_user_request_srp() (otg_user_request |= USER_RQST_SRP)
#define | Ack_user_request_srp() (otg_user_request &= ~USER_RQST_SRP)
#define | Is_user_requested_suspend() (((otg_user_request&USER_RQST_SUSPEND) != 0) ? TRUE : FALSE)
#define | Set_user_request_suspend() (otg_user_request |= USER_RQST_SUSPEND)
#define | Ack_user_request_suspend() (otg_user_request &= ~USER_RQST_SUSPEND)
#define | Is_user_requested_vbus() (((otg_user_request&USER_RQST_VBUS) != 0) ? TRUE : FALSE)
#define | Set_user_request_vbus() (otg_user_request |= USER_RQST_VBUS)
#define | Ack_user_request_vbus() (otg_user_request &= ~USER_RQST_VBUS)
#define | Is_user_requested_hnp() (((otg_user_request&USER_RQST_HNP) != 0) ? TRUE : FALSE)
#define | Set_user_request_hnp() (otg_user_request |= USER_RQST_HNP)
#define | Ack_user_request_hnp() (otg_user_request &= ~USER_RQST_HNP)
#define | Is_user_requested_disc() (((otg_user_request&USER_RQST_DISCONNECT) != 0) ? TRUE : FALSE)
#define | Set_user_request_disc() (otg_user_request |= USER_RQST_DISCONNECT)
#define | Ack_user_request_disc() (otg_user_request &= ~USER_RQST_DISCONNECT)
#define | Clear_all_user_request() (otg_user_request = 0)
#define | Otg_timer_init()
#define | OTG_COMPLIANCE_TRICKS DISABLED
#define | OTG_VBUS_AUTO_AFTER_A_PLUG_INSERTION DISABLED
#define | OTG_B_DEVICE_AUTORUN_HNP_IF_REQUIRED ENABLED
#define | OTG_RESET_LENGTH 1
#define | MSG_DISPLAY_NODELAY 0xFFFF
#define | OTG_TEMPO_1SEC 0x01F4
#define | OTG_TEMPO_2SEC 0x03E8
#define | OTG_TEMPO_3SEC 0x05DC
#define | OTG_TEMPO_4SEC 0x07D0
#define | OTR_TEMPO_5SEC 0x09C4
#define | OTGMSG_SRP_STARTED 1
#define | OTGMSG_SRP_A_NO_RESP 2
#define | OTGMSG_A_RESPONDED 3
#define | OTGMSG_CONNECTED_TO_A 4
#define | OTGMSG_UNSUPPORTED 5
#define | OTGMSG_UNSUPPORTED_HUB 6
#define | OTGMSG_SRP_RECEIVED 7
#define | OTGMSG_DEVICE_NO_RESP 8
#define | OTGMSG_VBUS_SURCHARGE 9
#define | OTGSTR_SRP_STARTED "SRP Initiated "
#define | OTGSTR_SRP_A_NO_RESP "A-Dev No Response "
#define | OTGSTR_A_RESPONDED "A-Device Responded"
#define | OTGSTR_CONNECTED_TO_A "Connected to A-Dev"
#define | OTGSTR_UNSUPPORTED "Unsupported Device"
#define | OTGSTR_UNSUPPORTED_HUB "Hub Unsuppported "
#define | OTGSTR_SRP_RECEIVED "SRP Received "
#define | OTGSTR_DEVICE_NO_RESP "Device No Response"
#define | OTGSTR_VBUS_SURCHARGE "VBUS OverCurrent !"
#define | OTGMSG_NONE 0
#define | OTGMSG_FAIL 1
#define | OTGMSG_ALL 2
#define | Otg_messaging_init()
#define | Otg_print_new_event_message(str, tm)
#define | Otg_clear_event_message()
#define | Get_event_msg_delay()
#define | Decrement_event_msg_delay()
#define | Otg_print_new_failure_message(str, tm)
#define | Otg_clear_failure_message()
#define | Get_failure_msg_delay()
#define | Decrement_failure_msg_delay()
## Functions
void | usb_task_init (void)
void | usb_task (void)
void | otg_not_supported_device (void)
## Variables
volatile U16 | g_usb_event
| Public : U16 g_usb_event usb_connected is used to store USB events detected upon USB general interrupt subroutine Its value is managed by the following macros (See usb_task.h file) Usb_send_event(x) Usb_ack_event(x) Usb_clear_all_event() Is_usb_event(x) Is_not_usb_event(x).
U8 | g_usb_mode
| Public : (U8) g_usb_mode Used in dual role application (both device/host) to store the current mode the usb controller is operating /.
U8 | remote_wakeup_feature
| Public : (U8) remote_wakeup_feature Store a host request for remote wake up (set feature received) /.
volatile U8 | private_sof_counter
| Private : (U8) private_sof_counter Incremented by host SOF interrupt subroutime This counter is used to detect timeout in host requests.
volatile U8 | otg_features_supported
U8 | otg_user_request
volatile U16 | g_otg_event
U8 | id_changed_to_host_event
U16 | otg_msg_event_delay
U16 | otg_msg_failure_delay

## Detailed Description

This file contains the function declarations - 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_task.h.