1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- #ifndef _HTC_API_H_
- #define _HTC_API_H_
- #include <htc.h>
- #include <htc_services.h>
- #include <qdf_types.h> /* qdf_device_t */
- #include "htc_packet.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define ENDPOINT1 0
- #define HTC_MAILBOX_NUM_MAX 4
- #define HTC_HEADER_LEN HTC_HDR_LENGTH
- #define HTC_HTT_TRANSFER_HDRSIZE 24
- struct opaque_htc_handle;
- typedef struct opaque_htc_handle *HTC_HANDLE;
- typedef uint16_t HTC_SERVICE_ID;
- typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status);
- struct htc_init_info {
- void *pContext;
- void (*TargetFailure)(void *Instance, QDF_STATUS Status);
- void (*TargetSendSuspendComplete)(void *ctx, bool is_nack,
- uint16_t reason_code);
- void (*target_initial_wakeup_cb)(void *cb_ctx);
- void *target_psoc;
- uint32_t cfg_wmi_credit_cnt;
-
- uint32_t htc_ready_timeout_ms;
- };
- struct ol_ath_htc_stats {
- int htc_get_pkt_q_fail_count;
- int htc_pkt_q_empty_count;
- int htc_send_q_empty_count;
- };
- typedef void (*HTC_EP_RESUME_TX_QUEUE)(void *);
- typedef int (*HTC_EP_PADDING_CREDIT_UPDATE) (void *, int);
- typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *, HTC_PACKET *);
- typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,
- HTC_PACKET_QUEUE *);
- typedef void (*HTC_EP_RECV_PKT)(void *, HTC_PACKET *);
- typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *, HTC_PACKET_QUEUE *);
- typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint);
- typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *,
- HTC_ENDPOINT_ID Endpoint,
- int Length);
- typedef void (*HTC_EP_LOG_PKT)(void *, HTC_PACKET *);
- enum htc_send_full_action {
-
- HTC_SEND_FULL_KEEP = 0,
-
- HTC_SEND_FULL_DROP = 1,
- };
- typedef enum htc_send_full_action (*HTC_EP_SEND_QUEUE_FULL)(void *,
- HTC_PACKET *pPacket);
- struct htc_ep_callbacks {
-
- void *pContext;
-
- HTC_EP_SEND_PKT_COMPLETE EpTxComplete;
-
- HTC_EP_RECV_PKT EpRecv;
-
- HTC_EP_RECV_REFILL EpRecvRefill;
-
- HTC_EP_SEND_QUEUE_FULL EpSendFull;
-
- HTC_EP_RECV_ALLOC EpRecvAlloc;
-
- HTC_EP_RECV_ALLOC EpRecvAllocThresh;
-
- HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple;
- HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue;
- HTC_EP_PADDING_CREDIT_UPDATE ep_padding_credit_update;
-
- int RecvAllocThreshold;
-
- int RecvRefillWaterMark;
-
- HTC_EP_LOG_PKT ep_log_pkt;
- };
- struct htc_service_connect_req {
-
- HTC_SERVICE_ID service_id;
-
- uint16_t ConnectionFlags;
-
- uint8_t *pMetaData;
-
- uint8_t MetaDataLength;
-
- struct htc_ep_callbacks EpCallbacks;
-
- int MaxSendQueueDepth;
-
- uint32_t LocalConnectionFlags;
-
- unsigned int MaxSendMsgSize;
- };
- #define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0)
- struct htc_service_connect_resp {
-
- uint8_t *pMetaData;
-
- uint8_t BufferLength;
-
- uint8_t ActualLength;
-
- HTC_ENDPOINT_ID Endpoint;
-
- unsigned int MaxMsgLength;
-
- uint8_t ConnectRespCode;
- };
- struct htc_endpoint_credit_dist {
- struct _htc_endpoint_credit_dist *pNext;
- struct _htc_endpoint_credit_dist *pPrev;
-
- HTC_SERVICE_ID service_id;
-
- HTC_ENDPOINT_ID Endpoint;
-
- uint32_t DistFlags;
-
- int TxCreditsNorm;
-
- int TxCreditsMin;
-
- int TxCreditsAssigned;
-
- int TxCredits;
-
- int TxCreditsToDist;
-
- int TxCreditsSeek;
-
- int TxCreditSize;
-
- int TxCreditsPerMaxMsg;
-
- void *pHTCReserved;
-
- int TxQueueDepth;
- };
- #define HTC_EP_ACTIVE ((uint32_t) (1u << 31))
- #define IS_EP_ACTIVE(epDist) ((epDist)->DistFlags & HTC_EP_ACTIVE)
- #define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE
- enum htc_credit_dist_reason {
-
- HTC_CREDIT_DIST_SEND_COMPLETE = 0,
-
- HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1,
-
- HTC_CREDIT_DIST_SEEK_CREDITS,
-
- HTC_DUMP_CREDIT_STATE
- };
- typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context,
- struct htc_endpoint_credit_dist *
- pEPList,
- enum htc_credit_dist_reason
- Reason);
- typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context,
- struct htc_endpoint_credit_dist *
- pEPList, int TotalCredits);
- enum htc_endpoint_stat_action {
-
- HTC_EP_STAT_SAMPLE = 0,
-
- HTC_EP_STAT_SAMPLE_AND_CLEAR = 1,
-
- HTC_EP_STAT_CLEAR
- };
- struct htc_endpoint_stats {
-
- uint32_t TxPosted;
-
- uint32_t TxCreditLowIndications;
-
- uint32_t TxIssued;
-
- uint32_t TxPacketsBundled;
-
- uint32_t TxBundles;
-
- uint32_t TxDropped;
-
- uint32_t TxCreditRpts;
-
- uint32_t TxCreditRptsFromRx;
-
- uint32_t TxCreditRptsFromOther;
-
- uint32_t TxCreditRptsFromEp0;
-
- uint32_t TxCreditsFromRx;
-
- uint32_t TxCreditsFromOther;
-
- uint32_t TxCreditsFromEp0;
-
- uint32_t TxCreditsConsummed;
-
- uint32_t TxCreditsReturned;
-
- uint32_t RxReceived;
-
- uint32_t RxLookAheads;
-
- uint32_t RxPacketsBundled;
-
- uint32_t RxBundleLookAheads;
-
- uint32_t RxBundleIndFromHdr;
-
- uint32_t RxAllocThreshHit;
-
- uint32_t RxAllocThreshBytes;
- };
- enum htc_link_vote_user_id {
- HTC_LINK_VOTE_INVALID_MIN_USER_ID = 0,
- HTC_LINK_VOTE_SAP_USER_ID = 1,
- HTC_LINK_VOTE_GO_USER_ID = 2,
- HTC_LINK_VOTE_NDP_USER_ID = 3,
- HTC_LINK_VOTE_SAP_DFS_USER_ID = 4,
- HTC_LINK_VOTE_STA_USER_ID = 5,
- HTC_LINK_VOTE_DIRECT_LINK_USER_ID = 6,
- HTC_LINK_VOTE_INVALID_MAX_USER_ID
- };
- HTC_HANDLE htc_create(void *HifDevice, struct htc_init_info *pInfo,
- qdf_device_t osdev, uint32_t con_mode);
- void *htc_get_hif_device(HTC_HANDLE HTCHandle);
- void htc_set_credit_distribution(HTC_HANDLE HTCHandle,
- void *pCreditDistContext,
- HTC_CREDIT_DIST_CALLBACK CreditDistFunc,
- HTC_CREDIT_INIT_CALLBACK CreditInitFunc,
- HTC_SERVICE_ID ServicePriorityOrder[],
- int ListLength);
- QDF_STATUS htc_wait_target(HTC_HANDLE HTCHandle);
- QDF_STATUS htc_start(HTC_HANDLE HTCHandle);
- QDF_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- struct htc_service_connect_req *pReq,
- struct htc_service_connect_resp *pResp);
- void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start);
- void htc_ce_tasklet_debug_dump(HTC_HANDLE htc_handle);
- QDF_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
- #ifdef CUSTOM_CB_SCHEDULER_SUPPORT
- QDF_STATUS
- htc_register_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
- void (*custom_cb)(void *), void *custom_cb_context);
- QDF_STATUS
- htc_unregister_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
- QDF_STATUS
- htc_enable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
- QDF_STATUS
- htc_disable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
- #else
- static inline QDF_STATUS
- htc_register_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id,
- void (*custom_cb)(void *), void *custom_cb_context)
- {
- return QDF_STATUS_SUCCESS;
- }
- static inline QDF_STATUS
- htc_unregister_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
- {
- return QDF_STATUS_SUCCESS;
- }
- static inline QDF_STATUS
- htc_enable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
- {
- return QDF_STATUS_SUCCESS;
- }
- static inline QDF_STATUS
- htc_disable_custom_cb(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id)
- {
- return QDF_STATUS_SUCCESS;
- }
- #endif
- #ifdef ATH_11AC_TXCOMPACT
- QDF_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
- int Epid, int ActualLength);
- #else
- QDF_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket,
- uint8_t more_data);
- #endif
- void htc_flush_surprise_remove(HTC_HANDLE HTCHandle);
- void htc_stop(HTC_HANDLE HTCHandle);
- void htc_destroy(HTC_HANDLE HTCHandle);
- void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint,
- HTC_TX_TAG Tag);
- void htc_dump_credit_states(HTC_HANDLE HTCHandle);
- void htc_indicate_activity_change(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID Endpoint, bool Active);
- bool htc_get_endpoint_statistics(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID Endpoint,
- enum htc_endpoint_stat_action Action,
- struct htc_endpoint_stats *pStats);
- void htc_unblock_recv(HTC_HANDLE HTCHandle);
- A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
- HTC_PACKET_QUEUE *pPktQueue);
- bool htc_is_endpoint_active(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID Endpoint);
- void htc_set_pkt_dbg(HTC_HANDLE handle, A_BOOL dbg_flag);
- void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt);
- void
- htc_enable_hdr_length_check(HTC_HANDLE htc_handle, bool htc_hdr_length_check);
- int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID Endpoint);
- void htc_set_target_failure_callback(HTC_HANDLE HTCHandle,
- HTC_TARGET_FAILURE Callback);
- void htc_enable_recv(HTC_HANDLE HTCHandle);
- void htc_disable_recv(HTC_HANDLE HTCHandle);
- A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
- uint32_t TimeoutInMs,
- bool *pbIsRecvPending);
- struct ol_ath_htc_stats *ieee80211_ioctl_get_htc_stats(HTC_HANDLE
- HTCHandle);
- int htc_get_tx_queue_depth(HTC_HANDLE htc_handle, HTC_ENDPOINT_ID endpoint_id);
- #ifdef WLAN_FEATURE_FASTPATH
- void htc_ctrl_msg_cmpl(HTC_HANDLE htc_pdev, HTC_ENDPOINT_ID htc_ep_id);
- #define HTC_TX_DESC_FILL(_htc_tx_desc, _download_len, _ep_id, _seq_no) \
- do { \
- HTC_WRITE32((_htc_tx_desc), \
- SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \
- SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \
- HTC_WRITE32((uint32_t *)(_htc_tx_desc) + 1, \
- SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1)); \
- } while (0)
- #endif
- #ifdef __cplusplus
- }
- #endif
- void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle,
- int *credit);
- void htc_dump_counter_info(HTC_HANDLE HTCHandle);
- void *htc_get_targetdef(HTC_HANDLE htc_handle);
- #ifdef FEATURE_RUNTIME_PM
- int htc_runtime_suspend(HTC_HANDLE htc_ctx);
- int htc_runtime_resume(HTC_HANDLE htc_ctx);
- #endif
- void htc_global_credit_flow_disable(void);
- void htc_global_credit_flow_enable(void);
- bool htc_can_suspend_link(HTC_HANDLE HTCHandle);
- #ifdef IPA_OFFLOAD
- void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle,
- qdf_shared_mem_t **ce_sr,
- uint32_t *ce_sr_ring_size,
- qdf_dma_addr_t *ce_reg_paddr);
- #else
- #define htc_ipa_get_ce_resource(htc_handle, \
- ce_sr, ce_sr_ring_size, ce_reg_paddr)
- #endif
- #if defined(DEBUG_HL_LOGGING) && defined(CONFIG_HL_SUPPORT)
- void htc_dump_bundle_stats(HTC_HANDLE HTCHandle);
- void htc_clear_bundle_stats(HTC_HANDLE HTCHandle);
- #endif
- #ifdef FEATURE_RUNTIME_PM
- int htc_pm_runtime_get(HTC_HANDLE htc_handle);
- int htc_pm_runtime_put(HTC_HANDLE htc_handle);
- int32_t htc_dec_return_htt_runtime_cnt(HTC_HANDLE htc);
- #else
- static inline int htc_pm_runtime_get(HTC_HANDLE htc_handle) { return 0; }
- static inline int htc_pm_runtime_put(HTC_HANDLE htc_handle) { return 0; }
- static inline
- int32_t htc_dec_return_htt_runtime_cnt(HTC_HANDLE htc)
- {
- return -1;
- }
- #endif
- #ifdef WLAN_DEBUG_LINK_VOTE
- void htc_log_link_user_votes(void);
- void htc_vote_link_down(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id);
- void htc_vote_link_up(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id);
- #else
- static inline
- void htc_log_link_user_votes(void)
- {
- }
- static inline
- void htc_vote_link_down(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
- {
- }
- static inline
- void htc_vote_link_up(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
- {
- }
- #endif
- void htc_set_async_ep(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID htc_ep_id, bool value);
- void htc_set_wmi_endpoint_count(HTC_HANDLE htc_handle, uint8_t wmi_ep_count);
- uint8_t htc_get_wmi_endpoint_count(HTC_HANDLE htc_handle);
- #ifdef FEATURE_HTC_CREDIT_HISTORY
- void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
- qdf_abstract_print * print, void *print_priv);
- #else
- static inline
- void htc_print_credit_history(HTC_HANDLE htc, uint32_t count,
- qdf_abstract_print *print, void *print_priv)
- {
- print(print_priv, "HTC Credit History Feature is disabled");
- }
- #endif
- #ifdef SYSTEM_PM_CHECK
- void htc_system_resume(HTC_HANDLE htc);
- #else
- static inline void htc_system_resume(HTC_HANDLE htc)
- {
- }
- #endif
- #endif
|