usb_task.h File Reference

,vThis file contains the function declarations More...

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_event(EVT_HOST_DISCONNECTION) || Is_usb_event(EVT_USB_DEVICE_FUNCTION))
#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 GET_STATUS   0x00
#define GET_DEVICE   0x01
#define CLEAR_FEATURE   0x01
 see FEATURES below
#define GET_STRING   0x03
#define SET_FEATURE   0x03
 see FEATURES below
#define SET_ADDRESS   0x05
#define GET_DESCRIPTOR   0x06
#define SET_DESCRIPTOR   0x07
#define GET_CONFIGURATION   0x08
#define SET_CONFIGURATION   0x09
#define GET_INTERFACE   0x0A
#define SET_INTERFACE   0x0B
#define SYNCH_FRAME   0x0C
#define GET_DEVICE_DESCRIPTOR   1
#define GET_CONFIGURATION_DESCRIPTOR   4
#define REQUEST_DEVICE_STATUS   0x80
#define REQUEST_INTERFACE_STATUS   0x81
#define REQUEST_ENDPOINT_STATUS   0x82
#define ZERO_TYPE   0x00
#define INTERFACE_TYPE   0x01
#define ENDPOINT_TYPE   0x02
#define DEVICE_DESCRIPTOR   0x01
#define CONFIGURATION_DESCRIPTOR   0x02
#define STRING_DESCRIPTOR   0x03
#define INTERFACE_DESCRIPTOR   0x04
#define ENDPOINT_DESCRIPTOR   0x05
#define DEVICE_QUALIFIER_DESCRIPTOR   0x06
#define OTHER_SPEED_CONFIGURATION_DESCRIPTOR   0x07
#define OTG_DESCRIPTOR   0x09
#define OTG_DESCRIPTOR_bLength   0x03
#define HNP_SUPPORT   0x02
#define SRP_SUPPORT   0x01
#define FEATURE_DEVICE_REMOTE_WAKEUP   0x01
#define FEATURE_ENDPOINT_HALT   0x00
#define TEST_J   0x01
#define TEST_K   0x02
#define TEST_SEO_NAK   0x03
#define TEST_PACKET   0x04
#define TEST_FORCE_ENABLE   0x05
#define BUS_POWERED   0
#define SELF_POWERED   1
#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
 Definitions of OTG user requests (user software requests).
#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()
 This macro initializes the timer for OTG specific timings.
#define OTG_COMPLIANCE_TRICKS   DISABLED
 Enable some additionnal feature to pass compliance plan.
#define OTG_VBUS_AUTO_AFTER_A_PLUG_INSERTION   DISABLED
 Selects a Vbus delivery option.
#define OTG_B_DEVICE_AUTORUN_HNP_IF_REQUIRED   ENABLED
 ENABLE to make the B-Device run a HNP automatically if a SetFeature(b_hnp_enable) is received and Suspend detected.
#define OTG_RESET_LENGTH   1
 Selects the Reset Length (x11ms).
#define MSG_DISPLAY_NODELAY   0xFFFF
 OTG Messaging definitions "No Silent Failure" rule makes any OTG compliant device handle messaging functions Differents means are supported : LCD display, LEDs, etc.
#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)
 This function initializes the USB proces.
void usb_task (void)
 Entry point of the USB mamnagement.
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
 External public declarations for OTG features.
U8 otg_user_request
 Public : (U8) otg_user_request; Store the last request of the user (see usb_device_task.h).
volatile U16 g_otg_event
 Public : (U16) g_otg_event; Contains several bits corresponding to differents OTG events (similar to g_usb_event).
U8 id_changed_to_host_event
U16 otg_msg_event_delay
 Public : (U16) otg_msg_event_delay; Contains the current display duration of the OTG event message.
U16 otg_msg_failure_delay
 Public : (U16) otg_msg_failure_delay; Contains the current display duration of the OTG failure message.


Detailed Description

,vThis file contains the function declarations

Copyright (c) 2006 Atmel.

Please read file license.txt for copyright notice.

Version:
1.12 at90usb128-otg-dual_role-toggle-1_0_0
Id
usb_task.h,v 1.12 2007/02/13 12:07:01 arobert Exp
Todo:
Bug:

Definition in file usb_task.h.


Generated on Mon Feb 19 09:32:09 2007 for Atmel by  doxygen 1.5.1-p1