usb_host_task.h File Reference

,vThis file contains the function declarations for usb host task functions More...

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

Go to the source code of this file.

Data Structures

struct  S_pipe_int

Defines

#define PIPE_GOOD   0
#define PIPE_DATA_TOGGLE   0x01
#define PIPE_DATA_PID   0x02
#define PIPE_PID   0x04
#define PIPE_TIMEOUT   0x08
#define PIPE_CRC16   0x10
#define PIPE_STALL   0x20
#define PIPE_NAK_TIMEOUT   0x40
#define PIPE_DELAY_TIMEOUT   0x80
#define Is_host_ready()   ((device_state==DEVICE_READY) ? TRUE : FALSE)
 Returns true when device connected and correctly enumerated.
#define Is_host_not_ready()   ((device_state==DEVICE_READY) ? FALSE :TRUE)
 Returns true when the high application should not perform request to the device.
#define Is_host_suspended()   (((device_state==DEVICE_WAIT_RESUME) ||(device_state==DEVICE_SUSPENDED)) ? TRUE : FALSE)
 Check if host controller is in suspend mode.
#define Is_host_not_suspended()   (((device_state==DEVICE_WAIT_RESUME) ||(device_state==DEVICE_SUSPENDED)) ? FALSE : TRUE)
 Check if host controller is not suspend mode.
#define Is_host_unattached()   ((device_state==DEVICE_UNATTACHED) ? TRUE : FALSE)
 Check if there is an attached device connected to the host.
#define Is_host_attached()   ((device_state>=DEVICE_UNATTACHED) ? TRUE : FALSE)
 Check if there is an attached device connected to the host.
#define Host_request_suspend()   (device_state=DEVICE_SUSPENDED)
 This function should be called to make the host controller enter USB suspend mode.
#define Host_request_resume()   (request_resume=TRUE)
 This function should be called to request the host controller to resume the USB bus.
#define Host_ack_request_resume()   (request_resume=FALSE)
 Private ack for software event.
#define Host_force_enumeration()   (force_enumeration=TRUE, device_state=DEVICE_ATTACHED)
 Force reset and (re)enumeration of the connected device.
#define Is_host_request_resume()   ((request_resume==TRUE) ? TRUE : FALSE)
 Private check for resume sequence.
#define Is_new_device_connection_event()   (new_device_connected ? TRUE : FALSE)
 Returns true when a new device is enumerated.
#define Is_device_disconnection_event()   ((device_state==DEVICE_DISCONNECTED_ACK || device_state==DEVICE_DISCONNECTED) ? TRUE : FALSE)
 Returns true when the device disconnects from the host.
#define Host_stop_pipe_interrupt(i)
 Stop all interrupt attached to a pipe.
#define DEVICE_UNATTACHED   0
#define DEVICE_ATTACHED   1
#define DEVICE_POWERED   2
#define DEVICE_DEFAULT   3
#define DEVICE_ADDRESSED   4
#define DEVICE_CONFIGURED   5
#define DEVICE_READY   6
#define DEVICE_ERROR   7
#define DEVICE_SUSPENDED   8
#define DEVICE_WAIT_RESUME   9
#define DEVICE_DISCONNECTED   10
#define DEVICE_DISCONNECTED_ACK   11
#define A_PERIPHERAL   12
#define A_INIT_HNP   13
#define A_SUSPEND   14
#define A_END_HNP_WAIT_VFALL   15
#define A_TEMPO_VBUS_DISCHARGE   16
#define Host_set_device_supported()   (device_status |= 0x01)
#define Host_clear_device_supported()   (device_status &= ~0x01)
#define Is_host_device_supported()   (device_status & 0x01)
#define Host_set_device_ready()   (device_status |= 0x02)
#define Host_clear_device_ready()   (device_status &= ~0x02)
#define Is_host_device_ready()   (device_status & 0x02)
#define Host_set_configured()   (device_status |= 0x04)
#define Host_clear_configured()   (device_status &= ~0x04)
#define Is_host_configured()   (device_status & 0x04)
#define Host_clear_device_status()   (device_status = 0x00)
#define USB_OTG_FEATURE   DISABLED
#define Srp_received_and_waiting_connect()   (otg_a_device_srp |= 0x01)
 Has a SRP been received, and waiting for a connect of B-Device (Vbus delivered).
#define Ack_srp_received_and_connect()   (otg_a_device_srp &= ~0x01)
#define Is_srp_received_and_waiting_connect()   (((otg_a_device_srp&0x01) != 0) ? TRUE : FALSE)
#define Host_session_started_srp()   (otg_a_device_srp |= 0x02)
 Is the current session has been started with SRP.
#define Host_end_session_started_srp()   (otg_a_device_srp &= ~0x02)
#define Is_host_session_started_srp()   (((otg_a_device_srp&0x02) != 0) ? TRUE : FALSE)
#define Peripheral_is_not_otg_device()   (otg_device_connected = 0x00)
 Is the current peripheral is an OTG device ?
#define Peripheral_is_otg_device()   (otg_device_connected = 0x11)
#define Is_peripheral_otg_device()   ((otg_device_connected != 0) ? TRUE : FALSE)
#define T_VBUS_DELIV_AFTER_SRP   0xDAC
 Check if counter of Vbus delivery time after SRP is elapsed.
#define Init_ta_srp_counter()   (otg_ta_srp_wait_connect = 0)
#define Is_ta_srp_counter_overflow()   ((otg_ta_srp_wait_connect > T_VBUS_DELIV_AFTER_SRP) ? TRUE : FALSE)
#define TA_AIDL_BDIS   0x800
 Check if counter of A-Suspend delay is elapsed.
#define Init_ta_aidl_bdis_counter()   (otg_ta_aidl_bdis_tmr = TA_AIDL_BDIS)
#define Is_ta_aidl_bdis_counter_overflow()   ((otg_ta_aidl_bdis_tmr == 0x0001) ? TRUE : FALSE)
#define TM_OUT_MAX_BDEV_RESPONSE   0xD00
 Check if counter otg_timeout_bdev_respond is elapsed.
#define Init_timeout_bdev_response()   (otg_timeout_bdev_respond = TM_OUT_MAX_BDEV_RESPONSE)
#define Is_timeout_bdev_response_overflow()   ((otg_timeout_bdev_respond == 0) ? TRUE : FALSE)
#define TA_VBUS_RISE   0x28
 Check if counter otg_ta_vbus_rise is elapsed.
#define Init_ta_vbus_rise_counter()   (otg_ta_vbus_rise = TA_VBUS_RISE)
#define Is_ta_vbus_rise_counter_overflow()   ((otg_ta_vbus_rise == 0) ? TRUE : FALSE)
#define TA_VBUS_FALL   50
 Check if counter otg_ta_vbus_fall is elapsed.
#define Init_ta_vbus_fall_counter()   (otg_end_hnp_vbus_delay = TA_VBUS_FALL)
#define Is_ta_vbus_fall_counter_overflow()   ((otg_end_hnp_vbus_delay == 0) ? TRUE : FALSE)

Functions

void usb_host_task_init (void)
 This function initializes the USB controller in host mode, the associated variables and interrupts enables.
void usb_host_task (void)
 Entry point of the host management.
U8 host_send_data (U8 pipe, U16 nb_data, U8 *buf)
 This function send nb_data pointed with *buf with the pipe number specified.
U8 host_get_data (U8 pipe, U16 *nb_data, U8 *buf)
 This function receives nb_data pointed with *buf with the pipe number specified.
U8 host_get_data_interrupt (U8 pipe, U16 nb_data, U8 *buf, void(*handle)(U8 status, U16 nb_byte))
 This function receives nb_data pointed with *buf with the pipe number specified.
U8 host_send_data_interrupt (U8 pipe, U16 nb_data, U8 *buf, void(*handle)(U8 status, U16 nb_byte))
 This function send nb_data pointed with *buf with the pipe number specified.
void reset_it_pipe_str (void)
U8 is_any_interrupt_pipe_active (void)

Variables

U8 ep_table []
 Physical EP to address device endpoints look-up table.
U8 device_state
 Public : U8 device_state Its value represent the current state of the device connected to the usb host controller Value can be:
  • DEVICE_ATTACHED
  • DEVICE_POWERED
  • DEVICE_SUSPENDED
  • DEVICE_DEFAULT
  • DEVICE_ADDRESSED
  • DEVICE_CONFIGURED
  • DEVICE_ERROR
  • DEVICE_UNATTACHED
  • DEVICE_READY
  • DEVICE_WAIT_RESUME
  • DEVICE_DISCONNECTED
  • DEVICE_DISCONNECTED_ACK.

U8 request_resume
U8 new_device_connected
U8 force_enumeration
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 /.
U16 otg_ta_srp_wait_connect
 Public : (U8) otg_device_connected; Min.
U16 otg_ta_aidl_bdis_tmr
 Public : (U8) otg_device_connected; Max.
U8 otg_ta_vbus_rise
 Public : (U8) otg_device_connected; Max.
U16 otg_timeout_bdev_respond
 Public : (U8) otg_device_connected; Max.
U16 otg_end_hnp_vbus_delay
 Public : (U8) otg_end_hnp_vbus_delay; Variable used for timing Vbus discharge to avoid bounces around vbus_valid threshold.
U8 otg_a_device_srp
 Public : (U8) otg_a_device_srp; Stores special events about SRP in A-Device mode.
U8 otg_device_connected
 Public : (U8) otg_device_connected; Indicates if the connected peripheral is an OTG Device or not.


Detailed Description

,vThis file contains the function declarations for usb host task functions

Copyright (c) 2004 Atmel.

Please read file license.txt for copyright notice.

Version:
1.10 at90usb128-otg-dual_role-toggle-1_0_0
Id
usb_host_task.h,v 1.10 2007/02/13 10:17:12 arobert Exp
Todo:
Bug:

Definition in file usb_host_task.h.


Define Documentation

#define PIPE_GOOD   0

Definition at line 41 of file usb_host_task.h.

Referenced by host_get_data(), host_send_data(), and usb_pipe_interrupt().

#define PIPE_DATA_TOGGLE   0x01

Definition at line 42 of file usb_host_task.h.

#define PIPE_DATA_PID   0x02

Definition at line 43 of file usb_host_task.h.

#define PIPE_PID   0x04

Definition at line 44 of file usb_host_task.h.

#define PIPE_TIMEOUT   0x08

Definition at line 45 of file usb_host_task.h.

#define PIPE_CRC16   0x10

Definition at line 46 of file usb_host_task.h.

#define PIPE_STALL   0x20

Definition at line 47 of file usb_host_task.h.

Referenced by host_get_data(), host_send_data(), and usb_pipe_interrupt().

#define PIPE_NAK_TIMEOUT   0x40

Definition at line 48 of file usb_host_task.h.

Referenced by host_get_data(), host_send_data(), and usb_pipe_interrupt().

#define PIPE_DELAY_TIMEOUT   0x80

Definition at line 49 of file usb_host_task.h.

Referenced by host_get_data(), host_send_data(), and usb_general_interrupt().


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