Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UHI for Android Open Accessory

Modules

 

Data Structures

struct  uhi_aoa_dev_t
 Stores relevant information about the USB connection. More...
 

Macros

#define UHI_AOA
 Global structure which contains standard UHI API for UHC. More...
 

Variables

volatile uint8_t uhi_aoa_enable_stage
 Stores the status of the process enabling the Accessory device. More...
 
volatile uint16_t uhi_aoa_protocol
 Stores the "Android Open Accessory Protocol" version. More...
 

Stages of enabling the Android Device

#define AOA_ENABLE_STAGE_PROCESSING   0
 
#define AOA_ENABLE_STAGE_SUCCESSFUL   1
 
#define AOA_ENABLE_STAGE_FAILED   2
 

Internal Defines and Variables to store information about the Accessory

static struct uhi_aoa_dev_t uhi_aoa_dev
 
void uhi_aoa_mode_enable_step1 (uhc_device_t *)
 Function to enable the Accessory Mode on Android Devices. More...
 
void uhi_aoa_mode_enable_step2 (usb_add_t, uhd_trans_status_t, uint16_t)
 Function to enable the Accessory Mode on Android Devices. More...
 
void uhi_aoa_mode_enable_step3 (usb_add_t, uhd_trans_status_t, uint16_t)
 Function to enable the Accessory Mode on Android Devices. More...
 
void uhi_aoa_mode_enable_complete (usb_add_t, uhd_trans_status_t, uint16_t)
 Function to enable the Accessory Mode on Android Devices. More...
 
#define uhi_aoa_dev_sel   (&uhi_aoa_dev)
 Current USB device AOA selected by the UHI AOA. More...
 
#define AOA_STRING_MANUFACTURER   "Atmel"
 
#define AOA_STRING_MODEL   "EVK1105"
 
#define AOA_STRING_DESCRIPTION   "EVK1105 Application Board"
 
#define AOA_STRING_VERSION   "1.0"
 
#define AOA_STRING_URL   "http://www.atmel.com/applications/homeentertainment/mobile_accessories/default.aspx"
 
#define AOA_STRING_SERIAL   "0000000012345678"
 

Functions required by UHC

uhc_enum_status_t uhi_aoa_install (uhc_device_t *dev)
 Functions required by UHC. More...
 
void uhi_aoa_enable (uhc_device_t *dev)
 
void uhi_aoa_uninstall (uhc_device_t *dev)
 

Routines to initialize the Android device

void uhi_aoa_send_info_string (uint8_t, char *, uhd_callback_setup_end_t)
 Function to send Identifying Information to the Android Device. More...
 
bool uhi_aoa_configure (uhc_device_t *)
 Tries to configure bulk Endpoints for the Android Accessory. More...
 
void main_event_aoa (uhc_device_t *, bool)
 Takes care of Devices being attached/detached. More...
 

Routines to communicate with the Android device

bool uhi_aoa_read (uint8_t *payload, uint16_t payload_size, uhd_callback_trans_t callback_end)
 Main Function to receive a message from an Android device. More...
 
bool uhi_aoa_write (uint8_t *payload, uint16_t payload_size, uhd_callback_trans_t callback_end)
 Main Function to send a message to an Android device. More...
 

#define AOA_ENABLE_STAGE_FAILED   2
#define AOA_ENABLE_STAGE_PROCESSING   0

Referenced by uhi_aoa_enable(), and uhi_aoa_install().

#define AOA_ENABLE_STAGE_SUCCESSFUL   1
#define AOA_STRING_DESCRIPTION   "EVK1105 Application Board"
#define AOA_STRING_MANUFACTURER   "Atmel"
#define AOA_STRING_MODEL   "EVK1105"
#define AOA_STRING_SERIAL   "0000000012345678"
#define AOA_STRING_URL   "http://www.atmel.com/applications/homeentertainment/mobile_accessories/default.aspx"
#define AOA_STRING_VERSION   "1.0"
#define UHI_AOA
Value:
{ \
.install = uhi_aoa_install, \
.enable = uhi_aoa_enable, \
.uninstall = uhi_aoa_uninstall, \
.sof_notify = NULL, \
}
void uhi_aoa_enable(uhc_device_t *dev)
Definition: uhi_aoa.c:249
#define NULL
Definition: lwip-1.4.0/src/include/lwip/def.h:47
void uhi_aoa_uninstall(uhc_device_t *dev)
Definition: uhi_aoa.c:263
uhc_enum_status_t uhi_aoa_install(uhc_device_t *dev)
Functions required by UHC.
Definition: uhi_aoa.c:158

Global structure which contains standard UHI API for UHC.

#define uhi_aoa_dev_sel   (&uhi_aoa_dev)

Current USB device AOA selected by the UHI AOA.

void main_event_aoa ( uhc_device_t ,
bool   
)

Takes care of Devices being attached/detached.

bool uhi_aoa_configure ( uhc_device_t )

Tries to configure bulk Endpoints for the Android Accessory.

Returns
true, if Configuration was successful
void uhi_aoa_mode_enable_complete ( usb_add_t  add,
uhd_trans_status_t  status,
uint16_t  payload_trans 
)

Function to enable the Accessory Mode on Android Devices.

  • Called when the process of trying to start the device in Accessory Mode is finished.
  • Determines whether the process of starting in Accessory Mode was successful
  • Does NOT check if the device is in Accessory Mode. That happens later

References AOA_ENABLE_STAGE_FAILED, AOA_ENABLE_STAGE_SUCCESSFUL, UHD_TRANS_NOERROR, and uhi_aoa_enable_stage.

Referenced by uhi_aoa_mode_enable_step3().

void uhi_aoa_mode_enable_step1 ( uhc_device_t dev)

Function to enable the Accessory Mode on Android Devices.

  • Implements step one of starting the Device in Accessory Mode
  • Checks the Protocol Version on the Android Device
  • Calls step two of starting the Device in Accessory Mode

References uhc_device_t::address, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_aoa_dev_t::dev, NULL, uhd_setup_request(), uhi_aoa_mode_enable_step2(), uhi_aoa_protocol, USB_REQ_AOA_GET_PROTOCOL, USB_REQ_DIR_IN, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_VENDOR, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.

Referenced by uhi_aoa_enable().

void uhi_aoa_mode_enable_step2 ( usb_add_t  add,
uhd_trans_status_t  status,
uint16_t  payload_trans 
)

Function to enable the Accessory Mode on Android Devices.

  • Implements steps two and three of starting the Device in Accessory Mode
  • Sends the Identifying Information as Strings
  • Calls step three of starting the Device in Accessory Mode

References AOA_ENABLE_STAGE_FAILED, AOA_STRING_DESCRIPTION, AOA_STRING_INDEX_DESCRIPTION, AOA_STRING_INDEX_MANUFACTURER, AOA_STRING_INDEX_MODEL, AOA_STRING_INDEX_SERIAL, AOA_STRING_INDEX_URL, AOA_STRING_INDEX_VERSION, AOA_STRING_MANUFACTURER, AOA_STRING_MODEL, AOA_STRING_SERIAL, AOA_STRING_URL, AOA_STRING_VERSION, le16_to_cpu, NULL, UHD_TRANS_NOERROR, uhi_aoa_enable_stage, uhi_aoa_mode_enable_step3(), uhi_aoa_protocol, and uhi_aoa_send_info_string().

Referenced by uhi_aoa_mode_enable_step1().

void uhi_aoa_mode_enable_step3 ( usb_add_t  add,
uhd_trans_status_t  status,
uint16_t  payload_trans 
)

Function to enable the Accessory Mode on Android Devices.

  • Implements step three of starting the Device in Accessory Mode
  • Sends the Request to Startup in Accessory Mode
  • Calls last step of starting the Device in Accessory Mode

References uhc_device_t::address, AOA_ENABLE_STAGE_FAILED, usb_setup_req_t::bmRequestType, usb_setup_req_t::bRequest, uhi_aoa_dev_t::dev, NULL, uhd_setup_request(), UHD_TRANS_NOERROR, uhi_aoa_enable_stage, uhi_aoa_mode_enable_complete(), USB_REQ_AOA_STARTUP, USB_REQ_DIR_OUT, USB_REQ_RECIP_DEVICE, USB_REQ_TYPE_VENDOR, usb_setup_req_t::wIndex, usb_setup_req_t::wLength, and usb_setup_req_t::wValue.

Referenced by uhi_aoa_mode_enable_step2().

bool uhi_aoa_read ( uint8_t *  payload,
uint16_t  payload_size,
uhd_callback_trans_t  callback_end 
)

Main Function to receive a message from an Android device.

Parameters
payloadPointer on the data to transfer
payload_sizeSize of the data to transfer
callback_endCallback to call at the end of transfer

References uhc_device_t::address, uhi_aoa_dev_t::dev, uhi_aoa_dev_t::ep_in, and uhd_ep_run().

void uhi_aoa_uninstall ( uhc_device_t dev)
bool uhi_aoa_write ( uint8_t *  payload,
uint16_t  payload_size,
uhd_callback_trans_t  callback_end 
)

Main Function to send a message to an Android device.

Parameters
payloadPointer on the data to transfer
payload_sizeSize of the data to transfer
callback_endCallback to call at the end of transfer

References uhc_device_t::address, uhi_aoa_dev_t::dev, uhi_aoa_dev_t::ep_out, and uhd_ep_run().

struct uhi_aoa_dev_t uhi_aoa_dev
static
Initial value:
= {
.dev = NULL,
}
#define NULL
Definition: lwip-1.4.0/src/include/lwip/def.h:47
volatile uint8_t uhi_aoa_enable_stage

Stores the status of the process enabling the Accessory device.

Referenced by uhi_aoa_enable(), uhi_aoa_install(), uhi_aoa_mode_enable_complete(), uhi_aoa_mode_enable_step2(), and uhi_aoa_mode_enable_step3().

volatile uint16_t uhi_aoa_protocol

Stores the "Android Open Accessory Protocol" version.

Referenced by uhi_aoa_mode_enable_step1(), and uhi_aoa_mode_enable_step2().