android wifi Direct Audio TX/RX延迟分析

时间:2023-05-09 18:59:26

1 Direct Audio TX代码流程

1.1 从Host到FW

1.1.1 代码流程

htc.c::HifLayerRecvCallback//从HIF_USB_CONTEXT获取数据中断,具体问俊奇

-> htc.c::_HTCPipeIndicateRecvMgs//HTC_SERVICE.ProcessRecvMsgMultiple = htt_tgt_hif_svc_h2t_input

-> htt_tgt_hif_svc.c::_htt_tgt_hif_svc_h2t_input//处理各类消息

-> htt_tgt_hif_svc.c::_htt_tgt_hif_svc_h2t_msg_dispatch//从HTC_BUFFER中读出h2t_msg_type=HTT_H2T_MSG_TYPE_TX_FRM

-> htt_tgt_tx.c::_htt_tgt_tx_input//处理HTT_H2T_MSG_TYPE_TX_FRM

-> ar_wal_tx_de.h::ar_wal_tx_de_input//调用_tx_de_input

-> ar_wal_tx_de_patch.c::patch_tx_de_input

1.1.2 重要的结构体

1.1.3 对应的log

enter htc.c::HifLayerRecvCallback.
enter htc.c::_HTCPipeIndicateRecvMgs.
enter htt_tgt_hif_svc.c::_htt_tgt_hif_svc_h2t_input.
enter htt_tgt_hif_svc.c::_htt_tgt_hif_svc_h2t_input call htt_tgt_hif_svc_h2t_msg_dispatch.
enter htt_tgt_hif_svc.c::_htt_tgt_hif_svc_h2t_msg_dispatch.
enter htt_tgt_tx.c::_htt_tgt_tx_input.
enter htt_tgt_tx.c::_htt_tgt_tx_input call ar_wal_tx_de_input 002, tid = 0.
enter ar_wal_tx_de_patch.c::patch_tx_de_input.

1.2 从FW到Air

1.2.1 代码流程

ar_wal_tx_send_patch.c::patch_tx_send_completion_hdlr//ACK处理函数,分析谁调用了它

-> ar_wal_tx_send_patch.c::patch_tx_send_proc_ppdu_done

/ar_wal_tx_send_patch.c::patch_tx_send_deliver_comp_pending_descs//comp_ctxt->tx_comp_ind_buf_send=htt_tgt_tx_compl_ind

-> htt_tgt_tx.c::_htt_tgt_tx_compl_ind

-> htt_tgt_hif_svc.c::_htt_tgt_hif_svc_msg_to_host

1.2.2 重要的结构体

struct wal_tx_msdu/wal_tx_msdu_t

结构体WHAL_TX_MSDU_DESC

结构体WHAL_TX_FRAG_DESC

举例:从struct wal_tx_mpdu* ppdu_mpdu_list中获取数据

A_UINT8* bufPtr = (A_UINT8*)(A_CPU_ADDR((WHAL_TX_FRAG_DESC*)A_CPU_ADDR(WHAL_MSDU_GET_DATA_REMOTE(WHAL_MSDU_DESC(msdu_desc)))->bufPtr));

(1) WHAL_MSDU_DESC(msdu_desc)强制转化成WHAL_TX_MSDU_DESC

(2) WHAL_MSDU_GET_DATA_REMOTE(msdu_desc_ptr)=WHAL_TX_MSDU_DESC.fragDescPtr

(3) (WHAL_TX_FRAG_DESC*)A_CPU_ADDR(frag_desc)->bufPtr=WHAL_TX_FRAG_DESC.bufPtr

struct ath_buf

struct htcWlanBuffers

struct txbuf

举例:从struct ath_buf中获取数据

A_UINT8* buffer = WLAN_BUF_START(abf->bf_b.wlanBuf.rx);

struct ath_buf->struct htcWlanBuffers->struct txbuf.bfdata_start

A_UINT32 length = WLAN_BUF_LENGTH(abf->bf_b.wlanBuf.rx);

struct ath_buf->struct htcWlanBuffers->struct txbuf.bfdata_len

1.2.3 对应的log:

enter ar_wal_tx_send_patch.c::patch_tx_send_completion_hdlr.
enter ar_wal_tx_send_patch.c::patch_tx_send_completion_hdlr call tx_send_proc_ppdu_done.
enter ar_wal_tx_send_patch.c::patch_tx_send_proc_ppdu_done.
enter ar_wal_tx_send_patch.c::patch_tx_send_deliver_comp_pending_descs.
enter htt_tgt_tx.c::_htt_tgt_tx_compl_ind.
enter htt_tgt_hif_svc.c::_htt_tgt_hif_svc_msg_to_host.