Atmel Software Framework

applications/uc3-audio-player/usb_host_task.h File Reference
#include "conf_usb.h"
#include "compiler.h"
#include "usb_host_enum.h"

Data Structures

struct  S_pipe_int
 

Macros

#define DEVICE_ADDRESSED   6
 
#define DEVICE_ATTACHED   3
 
#define DEVICE_CONFIGURED   7
 
#define DEVICE_DEFAULT   5
 
#define DEVICE_ERROR   9
 
#define DEVICE_POWERED   4
 
#define DEVICE_READY   8
 
#define DEVICE_SUSPENDED   10
 
#define DEVICE_UNATTACHED   2
 
#define DEVICE_UNSUPPORTED   0
 
#define DEVICE_VBUS_LOW   1
 
#define DEVICE_WAIT_RESUME   11
 
#define Host_ack_request_resume()   (request_resume = false)
 Private ack for resume software event. More...
 
#define Host_clear_configured()   (Clr_bits(usb_host_device_status, 0x04))
 
#define Host_clear_device_ready()   (Clr_bits(usb_host_device_status, 0x02))
 
#define Host_clear_device_status()   (usb_host_device_status = 0x00)
 
#define Host_clear_device_supported()   (Clr_bits(usb_host_device_status, 0x01))
 
#define Host_request_resume()   (request_resume = true)
 Should be called to request the host controller to resume the USB bus. More...
 
#define Host_request_suspend()   (device_state = DEVICE_SUSPENDED)
 Should be called to make the host controller enter USB suspend mode. More...
 
#define Host_set_configured()   (Set_bits(usb_host_device_status, 0x04))
 
#define Host_set_device_ready()   (Set_bits(usb_host_device_status, 0x02))
 
#define Host_set_device_supported()   (Set_bits(usb_host_device_status, 0x01))
 
#define Is_host_addressed()   (device_state >= DEVICE_ADDRESSED)
 Check if there is a device addressed by the host. More...
 
#define Is_host_attached()   (device_state >= DEVICE_ATTACHED)
 Check if there is a device attached to the host. More...
 
#define Is_host_configured()   (Tst_bits(usb_host_device_status, 0x04))
 
#define Is_host_detect_unsupported_dev()   (device_state == DEVICE_UNSUPPORTED)
 Check if an unsupported device is detected. More...
 
#define Is_host_device_ready()   (Tst_bits(usb_host_device_status, 0x02))
 
#define Is_host_device_supported()   (Tst_bits(usb_host_device_status, 0x01))
 
#define Is_host_error()   (device_state == DEVICE_ERROR)
 Check if there is an error. More...
 
#define Is_host_powered()   (device_state >= DEVICE_POWERED)
 Check if there is a device powered by the host. More...
 
#define Is_host_ready()   (device_state == DEVICE_READY)
 Returns true when device connected and correctly enumerated. More...
 
#define Is_host_request_resume()   (request_resume == true)
 Private check for resume sequence. More...
 
#define Is_host_suspended()
 Check if host controller is in suspend mode. More...
 
#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, uint16_t nb_byte)
 

Functions

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

Variables

uint8_t data_stage [SIZEOF_DATA_STAGE]
 Public: uint8_t 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. More...
 
volatile uint8_t device_state
 Public: uint8_t device_state Its value represents the current state of the device connected to the USB host controller Value can be: More...
 
volatile bool request_resume
 
volatile uint8_t usb_host_device_status
 
volatile S_usb_setup_data usb_request
 For control requests management over control pipe. More...