123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787 |
- #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
- typedef void *HTC_HANDLE;
- typedef uint16_t HTC_SERVICE_ID;
- typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status);
- typedef struct _HTC_INIT_INFO {
- void *pContext;
- void (*TargetFailure)(void *Instance, QDF_STATUS Status);
- void (*TargetSendSuspendComplete)(void *ctx, bool is_nack);
- void (*target_initial_wakeup_cb)(void);
- } HTC_INIT_INFO;
- 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 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 enum _HTC_SEND_FULL_ACTION {
- HTC_SEND_FULL_KEEP = 0,
- HTC_SEND_FULL_DROP = 1,
- } HTC_SEND_FULL_ACTION;
- typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *,
- HTC_PACKET *
- pPacket);
- typedef 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_RECV_PKT_MULTIPLE EpRecvPktMultiple;
- HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue;
- int RecvAllocThreshold;
- int RecvRefillWaterMark;
- } HTC_EP_CALLBACKS;
- typedef struct _HTC_SERVICE_CONNECT_REQ {
- HTC_SERVICE_ID service_id;
- uint16_t ConnectionFlags;
- uint8_t *pMetaData;
- uint8_t MetaDataLength;
- HTC_EP_CALLBACKS EpCallbacks;
- int MaxSendQueueDepth;
- uint32_t LocalConnectionFlags;
- unsigned int MaxSendMsgSize;
- } HTC_SERVICE_CONNECT_REQ;
- #define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0)
- typedef struct _HTC_SERVICE_CONNECT_RESP {
- uint8_t *pMetaData;
- uint8_t BufferLength;
- uint8_t ActualLength;
- HTC_ENDPOINT_ID Endpoint;
- unsigned int MaxMsgLength;
- uint8_t ConnectRespCode;
- } HTC_SERVICE_CONNECT_RESP;
- typedef 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;
- } HTC_ENDPOINT_CREDIT_DIST;
- #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
- typedef 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
- } HTC_CREDIT_DIST_REASON;
- typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
- pEPList,
- HTC_CREDIT_DIST_REASON
- Reason);
- typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context,
- HTC_ENDPOINT_CREDIT_DIST *
- pEPList, int TotalCredits);
- typedef enum _HTC_ENDPOINT_STAT_ACTION {
- HTC_EP_STAT_SAMPLE = 0,
- HTC_EP_STAT_SAMPLE_AND_CLEAR = 1,
- HTC_EP_STAT_CLEAR
- } HTC_ENDPOINT_STAT_ACTION;
- typedef 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;
- } HTC_ENDPOINT_STATS;
- HTC_HANDLE htc_create(void *HifDevice, 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);
- A_STATUS htc_wait_target(HTC_HANDLE HTCHandle);
- A_STATUS htc_start(HTC_HANDLE HTCHandle);
- A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
- A_STATUS htc_connect_service(HTC_HANDLE HTCHandle,
- HTC_SERVICE_CONNECT_REQ *pReq,
- HTC_SERVICE_CONNECT_RESP *pResp);
- void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start);
- A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
- #ifdef ATH_11AC_TXCOMPACT
- A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf,
- int Epid, int ActualLength);
- #else
- A_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,
- HTC_ENDPOINT_STAT_ACTION Action,
- HTC_ENDPOINT_STATS *pStats);
- void htc_unblock_recv(HTC_HANDLE HTCHandle);
- A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle,
- HTC_PACKET_QUEUE *pPktQueue);
- 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_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt);
- 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);
- #ifdef HIF_USB
- #define HTCReturnReceivePkt(target, p, osbuf) \
- do { \
- A_NETBUF_FREE(osbuf); \
- if (p->Status == A_CLONE) { \
- qdf_mem_free(p); \
- } \
- } while (0)
- #else
- #define HTCReturnReceivePkt(target, p, osbuf) htc_add_receive_pkt(target, p)
- #endif
- #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);
- void htc_vote_link_down(HTC_HANDLE HTCHandle);
- void htc_vote_link_up(HTC_HANDLE HTCHandle);
- #ifdef IPA_OFFLOAD
- void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle,
- qdf_dma_addr_t *ce_sr_base_paddr,
- uint32_t *ce_sr_ring_size,
- qdf_dma_addr_t *ce_reg_paddr);
- #else
- #define htc_ipa_get_ce_resource(htc_handle, \
- ce_sr_base_paddr, \
- 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);
- #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; }
- #endif
- void htc_set_async_ep(HTC_HANDLE HTCHandle,
- HTC_ENDPOINT_ID htc_ep_id, bool value);
- #endif
|