usb_host_task.h File Reference


Detailed Description

Management of the USB host controller.

This file manages the host controller, the host enumeration process and the suspend/resume host requests.

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

Definition in file usb_host_task.h.

#include "conf_usb.h"
#include "compiler.h"
#include "usb_host_enum.h"

Go to the source code of this file.

Data Structures

struct  S_pipe_int

Defines

#define DEVICE_ADDRESSED   4
#define DEVICE_ATTACHED   1
#define DEVICE_CONFIGURED   5
#define DEVICE_DEFAULT   3
#define DEVICE_ERROR   7
#define DEVICE_POWERED   2
#define DEVICE_READY   6
#define DEVICE_SUSPENDED   8
#define DEVICE_UNATTACHED   0
#define DEVICE_WAIT_RESUME   9
#define Host_ack_request_resume()   (request_resume = FALSE)
 Private ack for resume software event.
#define Host_clear_configured()   (Clr_bits(device_status, 0x04))
#define Host_clear_device_ready()   (Clr_bits(device_status, 0x02))
#define Host_clear_device_status()   (device_status = 0x00)
#define Host_clear_device_supported()   (Clr_bits(device_status, 0x01))
#define Host_request_resume()   (request_resume = TRUE)
 Should be called to request the host controller to resume the USB bus.
#define Host_request_suspend()   (device_state = DEVICE_SUSPENDED)
 Should be called to make the host controller enter USB suspend mode.
#define Host_set_configured()   (Set_bits(device_status, 0x04))
#define Host_set_device_ready()   (Set_bits(device_status, 0x02))
#define Host_set_device_supported()   (Set_bits(device_status, 0x01))
#define Is_host_addressed()   (device_state >= DEVICE_ADDRESSED)
 Check if there is a device addressed by the host.
#define Is_host_attached()   (device_state >= DEVICE_ATTACHED)
 Check if there is a device attached to the host.
#define Is_host_configured()   (Tst_bits(device_status, 0x04))
#define Is_host_device_ready()   (Tst_bits(device_status, 0x02))
#define Is_host_device_supported()   (Tst_bits(device_status, 0x01))
#define Is_host_error()   (device_state == DEVICE_ERROR)
 Check if there is an error.
#define Is_host_powered()   (device_state >= DEVICE_POWERED)
 Check if there is a device powered by the host.
#define Is_host_ready()   (device_state == DEVICE_READY)
 Returns TRUE when device connected and correctly enumerated.
#define Is_host_request_resume()   (request_resume == TRUE)
 Private check for resume sequence.
#define Is_host_suspended()
 Check if host controller is in suspend mode.
#define PIPE_CRC16   0x10
#define PIPE_DATA_PID   0x02
#define PIPE_DATA_TOGGLE   0x01
#define PIPE_DELAY_TIMEOUT   0x80
#define PIPE_GOOD   0x00
#define PIPE_NAK_TIMEOUT   0x40
#define PIPE_PID   0x04
#define PIPE_STALL   0x20
#define PIPE_TIMEOUT   0x08

Typedefs

typedef void Pipe_handler (Status_t status, U16 nb_byte)

Functions

Status_t host_get_data (U8 pipe, U16 *nb_data, void *ptr_buf)
 This function receives nb_data bytes pointed to by ptr_buf on the specified pipe.
Bool host_get_data_interrupt (U8 pipe, U16 nb_data, void *ptr_buf, Pipe_handler *handler)
 This function receives nb_data bytes pointed to by ptr_buf on the specified pipe.
Status_t host_send_data (U8 pipe, U16 nb_data, const void *ptr_buf)
 This function sends nb_data bytes pointed to by ptr_buf on the specified pipe.
Bool host_send_data_interrupt (U8 pipe, U16 nb_data, const void *ptr_buf, Pipe_handler *handler)
 This function sends nb_data bytes pointed to by ptr_buf on the specified pipe.
Bool is_any_interrupt_pipe_active (void)
void reset_it_pipe_str (void)
void usb_host_task (void *pvParameters)
 Entry point of the USB host management.
void usb_host_task_init (void)
 This function initializes the USB host controller.
void usb_pipe_interrupt (U8 pipe)
 USB pipe interrupt subroutine.

Variables

U8 data_stage [SIZEOF_DATA_STAGE]
 Public: U8 data_stage[SIZEOF_DATA_STAGE] Internal RAM buffer for USB data stage content This buffer is required to setup host enumeration process It contains the device descriptors received.
volatile U8 device_state
 Public: U8 device_state Its value represents 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.

volatile U8 device_status
volatile Bool request_resume
volatile S_usb_setup_data usb_request
 For control requests management over control pipe.


Generated on Fri Feb 19 02:27:51 2010 for AVR32 - USB Enumeration Example by  doxygen 1.5.5