USB Host AOAP API#

USBH_AOAP_ConfigureBufAlignOctets()#

Description#

Configures the alignment of the internal buffers.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void  USBH_AOAP_ConfigureBufAlignOctets (CPU_SIZE_T  buf_align_octets)

Arguments#

buf_align_octets

Buffer alignment, in octets.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the AOAP class is initialized via the USBH_AOAP_Init() function.

USBH_AOAP_ConfigureOptimizeSpdCfg()#

Description#

Sets the configurations required when optimize speed mode is enabled.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void  USBH_AOAP_ConfigureOptimizeSpdCfg(const  USBH_AOAP_CFG_OPTIMIZE_SPD  *p_optimize_spd_cfg)

Arguments#

p_optimize_spd_cfg

Pointer to the structure containing the configurations for the optimize speed mode.

Returned Value#

None.

Notes / Warnings#

  1. This function MUST be called before the AOAP class is initialized via the USBH_AOAP_Init() function.

  2. This function MUST be called when the USBH_CFG_OPTIMIZE_SPD_EN configuration is set to DEF_ENABLED.

USBH_AOAP_ConfigureInitAllocCfg()#

Description#

Sets the configurations required when allocation at initialization mode is enabled.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void  USBH_AOAP_ConfigureInitAllocCfg  (const  USBH_AOAP_CFG_INIT_ALLOC  *p_init_alloc_cfg)

Arguments#

p_init_alloc_cfg

Pointer to the structure containing the configurations for the allocation at initialization mode.

Returned Value#

None.

Notes / Warnings#

  1. This function MUST be called before the AOAP class is initialized via the USBH_AOAP_Init() function.

  2. This function MUST be called when the USBH_CFG_INIT_ALLOC_EN configuration is set to DEF_ENABLED.

USBH_AOAP_ConfigureMemSeg()#

Description#

Configures the memory segment to use when allocating control data and buffers.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void  USBH_AOAP_ConfigureMemSeg (MEM_SEG  *p_mem_seg,
                                 MEM_SEG  *p_mem_seg_buf)

Arguments#

p_mem_seg

  • Pointer to memory segment to use when allocating control data. Can be the same segment used for p_mem_seg_buf.

  • DEF_NULL means general purpose heap segment.

p_mem_seg_buf

  • Pointer to memory segment to use when allocating data buffers. Can be the same segment used for p_mem_seg.

  • DEF_NULL means general purpose heap segment.

Returned Value#

None.

Notes / Warnings#

  1. This function is optional, if it is not called, the default value will be used.

  2. This function MUST be called before the AOAP class is initialized via the USBH_AOAP_Init() function.

USBH_AOAP_Init()#

Description#

Initializes the AOAP Class.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void USBH_AOAP_Init (USBH_AOAP_STR_CFG    *p_str_cfg,
                     USBH_AOAP_APP_FNCTS  *p_app_fncts,
                     RTOS_ERR             *p_err)

Arguments#

p_str_cfg

Pointer to the configuration structure containing the AOAP strings. Content MUST be persistent.

p_app_fncts

Pointer to the callback functions structure. Content MUST be persistent.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_BLK_ALLOC_CALLBACK

Returned Value#

None.

Notes / Warnings#

None.

USBH_AOAP_StdReqTimeoutSet()#

Description#

Assigns a new timeout delay for the AOAP standard requests.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

void  USBH_AOAP_StdReqTimeoutSet(CPU_INT32U   std_req_timeout_ms,
                                 RTOS_ERR    *p_err)

Arguments#

std_req_timeout_ms

New timeout, in milliseconds.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

  • RTOS_ERR_NONE

Returned Value#

None.

Notes / Warnings#

None.

USBH_AOAP_DevHandleGet()#

Description#

Retrieves the device handle associated with the AOAP device.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

USBH_DEV_HANDLE USBH_AOAP_DevHandleGet (USBH_AOAP_FNCT_HANDLE   aoap_fnct_handle,
                                         RTOS_ERR               *p_err)

Arguments#

aoap_fnct_handle

Handle on the AOAP function.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Device handle.

Notes / Warnings#

None.

USBH_AOAP_AccDataRx()#

Description#

Receives the data from android accessory.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

CPU_INT32U USBH_AOAP_AccDataRx (USBH_AOAP_FNCT_HANDLE   aoap_fnct_handle,
                                 CPU_INT08U             *p_buf,
                                 CPU_INT32U              buf_len,
                                 CPU_INT32U              timeout,
                                 RTOS_ERR               *p_err)

Arguments#

aoap_fnct_handle

Handle on the AOAP function.

p_buf

Pointer to the buffer that will receive the data.

buf_len

Buffer length in octets.

timeout

Timeout in milliseconds.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_BLK_ALLOC_CALLBACK

  • RTOS_ERR_POOL_EMPTY

  • RTOS_ERR_INVALID_STATE

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_URB_ALLOC

  • RTOS_ERR_EP_INVALID

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_OS_ILLEGAL_RUN_TIME

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Received length, in octets.

Notes / Warnings#

None.

USBH_AOAP_AccDataTx()#

Description#

Send data to the android accessory.

Files#

usbh_aoap.h/usbh_aoap.c

Prototype#

CPU_INT32U USBH_AOAP_AccDataTx (USBH_AOAP_FNCT_HANDLE   aoap_fnct_handle,
                                 CPU_INT08U             *p_buf,
                                 CPU_INT32U              buf_len,
                                 CPU_INT32U              timeout,
                                 RTOS_ERR               *p_err)

Arguments#

aoap_fnct_handle

Handle on the AOAP function.

p_buf

Pointer to the buffer that contains the data to send.

buf_len

Buffer length in octets.

timeout

Timeout in milliseconds.

p_err

Pointer to the variable that will receive one of these return error codes from this function :

  • RTOS_ERR_NONE

  • RTOS_ERR_ABORT

  • RTOS_ERR_BLK_ALLOC_CALLBACK

  • RTOS_ERR_POOL_EMPTY

  • RTOS_ERR_INVALID_STATE

  • RTOS_ERR_INVALID_HANDLE

  • RTOS_ERR_URB_ALLOC

  • RTOS_ERR_EP_INVALID

  • RTOS_ERR_SEG_OVF

  • RTOS_ERR_OS_ILLEGAL_RUN_TIME

  • RTOS_ERR_TIMEOUT

  • RTOS_ERR_OS_OBJ_DEL

  • RTOS_ERR_NOT_AVAIL

Returned Value#

Transfer length, in octets.

Notes / Warnings#

None.