Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 1 | /* |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _HTC_API_H_ |
| 29 | #define _HTC_API_H_ |
| 30 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 31 | #include "osapi_linux.h" |
| 32 | #include "htc_packet.h" |
| 33 | #include <htc.h> |
| 34 | #include <htc_services.h> |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 35 | #include <qdf_types.h> /* qdf_device_t */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 36 | |
| 37 | #ifdef __cplusplus |
| 38 | extern "C" { |
| 39 | #endif /* __cplusplus */ |
| 40 | |
| 41 | /* TODO.. for BMI */ |
| 42 | #define ENDPOINT1 0 |
| 43 | /* TODO -remove me, but we have to fix BMI first */ |
| 44 | #define HTC_MAILBOX_NUM_MAX 4 |
| 45 | |
| 46 | /* this is the amount of header room required by users of HTC */ |
| 47 | #define HTC_HEADER_LEN HTC_HDR_LENGTH |
| 48 | |
| 49 | typedef void *HTC_HANDLE; |
| 50 | |
| 51 | typedef A_UINT16 HTC_SERVICE_ID; |
| 52 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 53 | typedef void (*HTC_TARGET_FAILURE)(void *Instance, QDF_STATUS Status); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 54 | |
| 55 | typedef struct _HTC_INIT_INFO { |
| 56 | void *pContext; /* context for target notifications */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 57 | void (*TargetFailure)(void *Instance, QDF_STATUS Status); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 58 | void (*TargetSendSuspendComplete)(void *ctx); |
| 59 | } HTC_INIT_INFO; |
| 60 | |
| 61 | /* Struct for HTC layer packet stats*/ |
| 62 | struct ol_ath_htc_stats { |
| 63 | int htc_get_pkt_q_fail_count; |
| 64 | int htc_pkt_q_empty_count; |
| 65 | int htc_send_q_empty_count; |
| 66 | }; |
| 67 | |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 68 | /* To resume HTT Tx queue during runtime resume */ |
| 69 | typedef void (*HTC_EP_RESUME_TX_QUEUE)(void *); |
| 70 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 71 | /* per service connection send completion */ |
| 72 | typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *, HTC_PACKET *); |
| 73 | /* per service connection callback when a plurality of packets have been sent |
| 74 | * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) |
| 75 | * to hold a list of completed send packets. |
| 76 | * If the handler cannot fully traverse the packet queue before returning, it should |
| 77 | * transfer the items of the queue into the caller's private queue using: |
| 78 | * HTC_PACKET_ENQUEUE() */ |
| 79 | typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *, |
| 80 | HTC_PACKET_QUEUE *); |
| 81 | /* per service connection pkt received */ |
| 82 | typedef void (*HTC_EP_RECV_PKT)(void *, HTC_PACKET *); |
| 83 | /* per service connection callback when a plurality of packets are received |
| 84 | * The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback) |
| 85 | * to hold a list of recv packets. |
| 86 | * If the handler cannot fully traverse the packet queue before returning, it should |
| 87 | * transfer the items of the queue into the caller's private queue using: |
| 88 | * HTC_PACKET_ENQUEUE() */ |
| 89 | typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *, HTC_PACKET_QUEUE *); |
| 90 | |
| 91 | /* Optional per service connection receive buffer re-fill callback, |
| 92 | * On some OSes (like Linux) packets are allocated from a global pool and indicated up |
| 93 | * to the network stack. The driver never gets the packets back from the OS. For these OSes |
| 94 | * a refill callback can be used to allocate and re-queue buffers into HTC. |
| 95 | * |
| 96 | * On other OSes, the network stack can call into the driver's OS-specifc "return_packet" handler and |
| 97 | * the driver can re-queue these buffers into HTC. In this regard a refill callback is |
| 98 | * unnecessary */ |
| 99 | typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint); |
| 100 | |
| 101 | /* Optional per service connection receive buffer allocation callback. |
| 102 | * On some systems packet buffers are an extremely limited resource. Rather than |
| 103 | * queue largest-possible-sized buffers to HTC, some systems would rather |
| 104 | * allocate a specific size as the packet is received. The trade off is |
| 105 | * slightly more processing (callback invoked for each RX packet) |
| 106 | * for the benefit of committing fewer buffer resources into HTC. |
| 107 | * |
| 108 | * The callback is provided the length of the pending packet to fetch. This includes the |
| 109 | * HTC header length plus the length of payload. The callback can return a pointer to |
| 110 | * the allocated HTC packet for immediate use. |
| 111 | * |
| 112 | * Alternatively a variant of this handler can be used to allocate large receive packets as needed. |
| 113 | * For example an application can use the refill mechanism for normal packets and the recv-alloc mechanism to |
| 114 | * handle the case where a large packet buffer is required. This can significantly reduce the |
| 115 | * amount of "committed" memory used to receive packets. |
| 116 | * |
| 117 | * */ |
| 118 | typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *, |
| 119 | HTC_ENDPOINT_ID Endpoint, |
| 120 | int Length); |
| 121 | |
| 122 | typedef enum _HTC_SEND_FULL_ACTION { |
| 123 | HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */ |
| 124 | HTC_SEND_FULL_DROP = 1, /* packet that overflowed should be dropped */ |
| 125 | } HTC_SEND_FULL_ACTION; |
| 126 | |
| 127 | /* Optional per service connection callback when a send queue is full. This can occur if the |
| 128 | * host continues queueing up TX packets faster than credits can arrive |
| 129 | * To prevent the host (on some Oses like Linux) from continuously queueing packets |
| 130 | * and consuming resources, this callback is provided so that that the host |
| 131 | * can disable TX in the subsystem (i.e. network stack). |
| 132 | * This callback is invoked for each packet that "overflows" the HTC queue. The callback can |
| 133 | * determine whether the new packet that overflowed the queue can be kept (HTC_SEND_FULL_KEEP) or |
| 134 | * dropped (HTC_SEND_FULL_DROP). If a packet is dropped, the EpTxComplete handler will be called |
| 135 | * and the packet's status field will be set to A_NO_RESOURCE. |
| 136 | * Other OSes require a "per-packet" indication for each completed TX packet, this |
| 137 | * closed loop mechanism will prevent the network stack from overunning the NIC |
| 138 | * The packet to keep or drop is passed for inspection to the registered handler the handler |
| 139 | * must ONLY inspect the packet, it may not free or reclaim the packet. */ |
| 140 | typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *, |
| 141 | HTC_PACKET * |
| 142 | pPacket); |
| 143 | |
| 144 | typedef struct _HTC_EP_CALLBACKS { |
| 145 | void *pContext; /* context for each callback */ |
| 146 | HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */ |
| 147 | HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */ |
| 148 | HTC_EP_RECV_REFILL EpRecvRefill; /* OPTIONAL receive re-fill callback for connected endpoint */ |
| 149 | HTC_EP_SEND_QUEUE_FULL EpSendFull; /* OPTIONAL send full callback */ |
| 150 | HTC_EP_RECV_ALLOC EpRecvAlloc; /* OPTIONAL recv allocation callback */ |
| 151 | HTC_EP_RECV_ALLOC EpRecvAllocThresh; /* OPTIONAL recv allocation callback based on a threshold */ |
| 152 | HTC_EP_SEND_PKT_COMP_MULTIPLE EpTxCompleteMultiple; /* OPTIONAL completion handler for multiple complete |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 153 | indications (EpTxComplete must be NULL) */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 154 | HTC_EP_RECV_PKT_MULTIPLE EpRecvPktMultiple; /* OPTIONAL completion handler for multiple |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 155 | recv packet indications (EpRecv must be NULL) */ |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 156 | HTC_EP_RESUME_TX_QUEUE ep_resume_tx_queue; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 157 | int RecvAllocThreshold; /* if EpRecvAllocThresh is non-NULL, HTC will compare the |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 158 | threshold value to the current recv packet length and invoke |
| 159 | the EpRecvAllocThresh callback to acquire a packet buffer */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 160 | int RecvRefillWaterMark; /* if a EpRecvRefill handler is provided, this value |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 161 | can be used to set a trigger refill callback |
| 162 | when the recv queue drops below this value |
| 163 | if set to 0, the refill is only called when packets |
| 164 | are empty */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 165 | } HTC_EP_CALLBACKS; |
| 166 | |
| 167 | /* service connection information */ |
| 168 | typedef struct _HTC_SERVICE_CONNECT_REQ { |
Houston Hoffman | 4f2f459 | 2015-10-20 18:00:29 -0700 | [diff] [blame] | 169 | HTC_SERVICE_ID service_id; /* service ID to connect to */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 170 | A_UINT16 ConnectionFlags; /* connection flags, see htc protocol definition */ |
| 171 | A_UINT8 *pMetaData; /* ptr to optional service-specific meta-data */ |
| 172 | A_UINT8 MetaDataLength; /* optional meta data length */ |
| 173 | HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */ |
| 174 | int MaxSendQueueDepth; /* maximum depth of any send queue */ |
| 175 | A_UINT32 LocalConnectionFlags; /* HTC flags for the host-side (local) connection */ |
| 176 | unsigned int MaxSendMsgSize; /* override max message size in send direction */ |
| 177 | } HTC_SERVICE_CONNECT_REQ; |
| 178 | |
| 179 | #define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */ |
| 180 | |
| 181 | /* service connection response information */ |
| 182 | typedef struct _HTC_SERVICE_CONNECT_RESP { |
| 183 | A_UINT8 *pMetaData; /* caller supplied buffer to optional meta-data */ |
| 184 | A_UINT8 BufferLength; /* length of caller supplied buffer */ |
| 185 | A_UINT8 ActualLength; /* actual length of meta data */ |
| 186 | HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */ |
| 187 | unsigned int MaxMsgLength; /* max length of all messages over this endpoint */ |
| 188 | A_UINT8 ConnectRespCode; /* connect response code from target */ |
| 189 | } HTC_SERVICE_CONNECT_RESP; |
| 190 | |
| 191 | /* endpoint distribution structure */ |
| 192 | typedef struct _HTC_ENDPOINT_CREDIT_DIST { |
| 193 | struct _HTC_ENDPOINT_CREDIT_DIST *pNext; |
| 194 | struct _HTC_ENDPOINT_CREDIT_DIST *pPrev; |
Houston Hoffman | 4f2f459 | 2015-10-20 18:00:29 -0700 | [diff] [blame] | 195 | HTC_SERVICE_ID service_id; /* Service ID (set by HTC) */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 196 | HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */ |
| 197 | A_UINT32 DistFlags; /* distribution flags, distribution function can |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 198 | set default activity using SET_EP_ACTIVE() macro */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 199 | int TxCreditsNorm; /* credits for normal operation, anything above this |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 200 | indicates the endpoint is over-subscribed, this field |
| 201 | is only relevant to the credit distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 202 | int TxCreditsMin; /* floor for credit distribution, this field is |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 203 | only relevant to the credit distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 204 | int TxCreditsAssigned; /* number of credits assigned to this EP, this field |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 205 | is only relevant to the credit dist function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 206 | int TxCredits; /* current credits available, this field is used by |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 207 | HTC to determine whether a message can be sent or |
| 208 | must be queued */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 209 | int TxCreditsToDist; /* pending credits to distribute on this endpoint, this |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 210 | is set by HTC when credit reports arrive. |
| 211 | The credit distribution functions sets this to zero |
| 212 | when it distributes the credits */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 213 | int TxCreditsSeek; /* this is the number of credits that the current pending TX |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 214 | packet needs to transmit. This is set by HTC when |
| 215 | and endpoint needs credits in order to transmit */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 216 | int TxCreditSize; /* size in bytes of each credit (set by HTC) */ |
| 217 | int TxCreditsPerMaxMsg; /* credits required for a maximum sized messages (set by HTC) */ |
| 218 | void *pHTCReserved; /* reserved for HTC use */ |
| 219 | int TxQueueDepth; /* current depth of TX queue , i.e. messages waiting for credits |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 220 | This field is valid only when HTC_CREDIT_DIST_ACTIVITY_CHANGE |
| 221 | or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint |
| 222 | that has non-zero credits to recover |
| 223 | */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 224 | } HTC_ENDPOINT_CREDIT_DIST; |
| 225 | |
| 226 | #define HTC_EP_ACTIVE ((A_UINT32) (1u << 31)) |
| 227 | |
| 228 | /* macro to check if an endpoint has gone active, useful for credit |
| 229 | * distributions */ |
| 230 | #define IS_EP_ACTIVE(epDist) ((epDist)->DistFlags & HTC_EP_ACTIVE) |
| 231 | #define SET_EP_ACTIVE(epDist) (epDist)->DistFlags |= HTC_EP_ACTIVE |
| 232 | |
| 233 | /* credit distibution code that is passed into the distrbution function, |
| 234 | * there are mandatory and optional codes that must be handled */ |
| 235 | typedef enum _HTC_CREDIT_DIST_REASON { |
| 236 | HTC_CREDIT_DIST_SEND_COMPLETE = 0, /* credits available as a result of completed |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 237 | send operations (MANDATORY) resulting in credit reports */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 238 | HTC_CREDIT_DIST_ACTIVITY_CHANGE = 1, /* a change in endpoint activity occured (OPTIONAL) */ |
| 239 | HTC_CREDIT_DIST_SEEK_CREDITS, /* an endpoint needs to "seek" credits (OPTIONAL) */ |
| 240 | HTC_DUMP_CREDIT_STATE /* for debugging, dump any state information that is kept by |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 241 | the distribution function */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 242 | } HTC_CREDIT_DIST_REASON; |
| 243 | |
| 244 | typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context, |
| 245 | HTC_ENDPOINT_CREDIT_DIST * |
| 246 | pEPList, |
| 247 | HTC_CREDIT_DIST_REASON |
| 248 | Reason); |
| 249 | |
| 250 | typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context, |
| 251 | HTC_ENDPOINT_CREDIT_DIST * |
| 252 | pEPList, int TotalCredits); |
| 253 | |
| 254 | /* endpoint statistics action */ |
| 255 | typedef enum _HTC_ENDPOINT_STAT_ACTION { |
| 256 | HTC_EP_STAT_SAMPLE = 0, /* only read statistics */ |
| 257 | HTC_EP_STAT_SAMPLE_AND_CLEAR = 1, /* sample and immediately clear statistics */ |
| 258 | HTC_EP_STAT_CLEAR /* clear only */ |
| 259 | } HTC_ENDPOINT_STAT_ACTION; |
| 260 | |
| 261 | /* endpoint statistics */ |
| 262 | typedef struct _HTC_ENDPOINT_STATS { |
| 263 | A_UINT32 TxPosted; /* number of TX packets posted to the endpoint */ |
| 264 | A_UINT32 TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 265 | this endpoint */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 266 | A_UINT32 TxIssued; /* running count of total TX packets issued */ |
| 267 | A_UINT32 TxPacketsBundled; /* running count of TX packets that were issued in bundles */ |
| 268 | A_UINT32 TxBundles; /* running count of TX bundles that were issued */ |
| 269 | A_UINT32 TxDropped; /* tx packets that were dropped */ |
| 270 | A_UINT32 TxCreditRpts; /* running count of total credit reports received for this endpoint */ |
| 271 | A_UINT32 TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */ |
| 272 | A_UINT32 TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */ |
| 273 | A_UINT32 TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */ |
| 274 | A_UINT32 TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */ |
| 275 | A_UINT32 TxCreditsFromOther; /* count of credits received via another endpoint */ |
| 276 | A_UINT32 TxCreditsFromEp0; /* count of credits received via another endpoint */ |
| 277 | A_UINT32 TxCreditsConsummed; /* count of consummed credits */ |
| 278 | A_UINT32 TxCreditsReturned; /* count of credits returned */ |
| 279 | A_UINT32 RxReceived; /* count of RX packets received */ |
| 280 | A_UINT32 RxLookAheads; /* count of lookahead records |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 281 | found in messages received on this endpoint */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 282 | A_UINT32 RxPacketsBundled; /* count of recv packets received in a bundle */ |
| 283 | A_UINT32 RxBundleLookAheads; /* count of number of bundled lookaheads */ |
| 284 | A_UINT32 RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */ |
| 285 | A_UINT32 RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */ |
| 286 | A_UINT32 RxAllocThreshBytes; /* total number of bytes */ |
| 287 | } HTC_ENDPOINT_STATS; |
| 288 | |
| 289 | /* ------ Function Prototypes ------ */ |
| 290 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 291 | @desc: Create an instance of HTC over the underlying HIF device |
| 292 | @function name: htc_create |
| 293 | @input: HifDevice - hif device handle, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 294 | pInfo - initialization information |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 295 | @output: |
| 296 | @return: HTC_HANDLE on success, NULL on failure |
| 297 | @notes: |
| 298 | @example: |
| 299 | @see also: htc_destroy |
| 300 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 301 | HTC_HANDLE htc_create(void *HifDevice, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 302 | HTC_INIT_INFO *pInfo, qdf_device_t osdev); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 303 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 304 | @desc: Get the underlying HIF device handle |
| 305 | @function name: htc_get_hif_device |
| 306 | @input: HTCHandle - handle passed into the AddInstance callback |
| 307 | @output: |
| 308 | @return: opaque HIF device handle usable in HIF API calls. |
| 309 | @notes: |
| 310 | @example: |
| 311 | @see also: |
| 312 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 313 | void *htc_get_hif_device(HTC_HANDLE HTCHandle); |
| 314 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 315 | @desc: Set credit distribution parameters |
| 316 | @function name: htc_set_credit_distribution |
| 317 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 318 | pCreditDistCont - caller supplied context to pass into distribution functions |
| 319 | CreditDistFunc - Distribution function callback |
| 320 | CreditDistInit - Credit Distribution initialization callback |
| 321 | ServicePriorityOrder - Array containing list of service IDs, lowest index |
| 322 | is highestpriority |
| 323 | ListLength - number of elements in ServicePriorityOrder |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 324 | @output: |
| 325 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 326 | @notes : The user can set a custom credit distribution function to handle |
| 327 | special requirementsfor each endpoint. A default credit distribution |
| 328 | routine can be used by setting CreditInitFunc to NULL. The default |
| 329 | credit distribution is only provided for simple "fair" credit distribution |
| 330 | without regard to any prioritization. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 331 | |
| 332 | @example: |
| 333 | @see also: |
| 334 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 335 | void htc_set_credit_distribution(HTC_HANDLE HTCHandle, |
| 336 | void *pCreditDistContext, |
| 337 | HTC_CREDIT_DIST_CALLBACK CreditDistFunc, |
| 338 | HTC_CREDIT_INIT_CALLBACK CreditInitFunc, |
| 339 | HTC_SERVICE_ID ServicePriorityOrder[], |
| 340 | int ListLength); |
| 341 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 342 | @desc: Wait for the target to indicate the HTC layer is ready |
| 343 | @function name: htc_wait_target |
| 344 | @input: HTCHandle - HTC handle |
| 345 | @output: |
| 346 | @return: |
| 347 | @notes: This API blocks until the target responds with an HTC ready message. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 348 | The caller should not connect services until the target has indicated it is |
| 349 | ready. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 350 | @example: |
| 351 | @see also: htc_connect_service |
| 352 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 353 | A_STATUS htc_wait_target(HTC_HANDLE HTCHandle); |
| 354 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 355 | @desc: Start target service communications |
| 356 | @function name: htc_start |
| 357 | @input: HTCHandle - HTC handle |
| 358 | @output: |
| 359 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 360 | @notes: This API indicates to the target that the service connection phase |
| 361 | is completeand the target can freely start all connected services. This |
| 362 | API should only be called AFTER all service connections have been made. |
| 363 | TCStart will issue a SETUP_COMPLETE message to the target to indicate that |
| 364 | all service connections have been made and the target can start |
| 365 | communicating over the endpoints. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 366 | @example: |
| 367 | @see also: htc_connect_service |
| 368 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 369 | A_STATUS htc_start(HTC_HANDLE HTCHandle); |
| 370 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 371 | @desc: Add receive packet to HTC |
| 372 | @function name: htc_add_receive_pkt |
| 373 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 374 | pPacket - HTC receive packet to add |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 375 | @output: |
| 376 | @return: A_OK on success |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 377 | @notes: user must supply HTC packets for capturing incomming HTC frames. |
| 378 | The caller must initialize each HTC packet using the |
| 379 | SET_HTC_PACKET_INFO_RX_REFILL() macro. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 380 | @example: |
| 381 | @see also: |
| 382 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 383 | A_STATUS htc_add_receive_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); |
| 384 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 385 | @desc: Connect to an HTC service |
| 386 | @function name: htc_connect_service |
| 387 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 388 | pReq - connection details |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 389 | @output: pResp - connection response |
| 390 | @return: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 391 | @notes: Service connections must be performed before htc_start. |
| 392 | User provides callback handlersfor various endpoint events. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 393 | @example: |
| 394 | @see also: htc_start |
| 395 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 396 | A_STATUS htc_connect_service(HTC_HANDLE HTCHandle, |
| 397 | HTC_SERVICE_CONNECT_REQ *pReq, |
| 398 | HTC_SERVICE_CONNECT_RESP *pResp); |
| 399 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 400 | @desc: HTC register log dump |
| 401 | @function name: htc_dump |
| 402 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 403 | CmdId - Log command |
| 404 | start - start/print logs |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 405 | @output: |
| 406 | @return: |
| 407 | @notes: Register logs will be started/printed. |
| 408 | be flushed. |
| 409 | @example: |
| 410 | @see also: |
| 411 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 412 | |
| 413 | void htc_dump(HTC_HANDLE HTCHandle, uint8_t CmdId, bool start); |
| 414 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 415 | @desc: Send an HTC packet |
| 416 | @function name: htc_send_pkt |
| 417 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 418 | pPacket - packet to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 419 | @output: |
| 420 | @return: A_OK |
| 421 | @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 422 | This interface is fully asynchronous. On error, HTC SendPkt will |
| 423 | call the registered Endpoint callback to cleanup the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 424 | @example: |
| 425 | @see also: htc_flush_endpoint |
| 426 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 427 | A_STATUS htc_send_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket); |
| 428 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 429 | @desc: Send an HTC packet containing a tx descriptor and data |
| 430 | @function name: htc_send_data_pkt |
| 431 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 432 | pPacket - packet to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 433 | @output: |
| 434 | @return: A_OK |
| 435 | @notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 436 | Caller must provide headroom in an initial fragment added to the |
| 437 | network buffer to store a HTC_FRAME_HDR. |
| 438 | This interface is fully asynchronous. On error, htc_send_data_pkt will |
| 439 | call the registered Endpoint EpDataTxComplete callback to cleanup |
| 440 | the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 441 | @example: |
| 442 | @see also: htc_send_pkt |
| 443 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 444 | #ifdef ATH_11AC_TXCOMPACT |
Vishwajith Upendra | 70f8b6e | 2016-03-01 16:28:23 +0530 | [diff] [blame] | 445 | A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, qdf_nbuf_t netbuf, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 446 | int Epid, int ActualLength); |
| 447 | #else /*ATH_11AC_TXCOMPACT */ |
| 448 | A_STATUS htc_send_data_pkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket, |
| 449 | A_UINT8 more_data); |
| 450 | #endif /*ATH_11AC_TXCOMPACT */ |
| 451 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 452 | @desc: Flush HTC when target is removed surprisely service communications |
| 453 | @function name: htc_flush_surprise_remove |
| 454 | @input: HTCHandle - HTC handle |
| 455 | @output: |
| 456 | @return: |
| 457 | @notes: All receive and pending TX packets will |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 458 | be flushed. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 459 | @example: |
| 460 | @see also: |
| 461 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 462 | void htc_flush_surprise_remove(HTC_HANDLE HTCHandle); |
| 463 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 464 | @desc: Stop HTC service communications |
| 465 | @function name: htc_stop |
| 466 | @input: HTCHandle - HTC handle |
| 467 | @output: |
| 468 | @return: |
| 469 | @notes: HTC communications is halted. All receive and pending TX packets will |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 470 | be flushed. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 471 | @example: |
| 472 | @see also: |
| 473 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 474 | void htc_stop(HTC_HANDLE HTCHandle); |
| 475 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 476 | @desc: Destory HTC service |
| 477 | @function name: htc_destroy |
| 478 | @input: HTCHandle |
| 479 | @output: |
| 480 | @return: |
| 481 | @notes: This cleans up all resources allocated by htc_create(). |
| 482 | @example: |
| 483 | @see also: htc_create |
| 484 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 485 | void htc_destroy(HTC_HANDLE HTCHandle); |
| 486 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 487 | @desc: Flush pending TX packets |
| 488 | @function name: htc_flush_endpoint |
| 489 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 490 | Endpoint - Endpoint to flush |
| 491 | Tag - flush tag |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 492 | @output: |
| 493 | @return: |
| 494 | @notes: The Tag parameter is used to selectively flush packets with matching tags. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 495 | The value of 0 forces all packets to be flush regardless of tag. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 496 | @example: |
| 497 | @see also: htc_send_pkt |
| 498 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 499 | void htc_flush_endpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, |
| 500 | HTC_TX_TAG Tag); |
| 501 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 502 | @desc: Dump credit distribution state |
| 503 | @function name: htc_dump_credit_states |
| 504 | @input: HTCHandle - HTC handle |
| 505 | @output: |
| 506 | @return: |
| 507 | @notes: This dumps all credit distribution information to the debugger |
| 508 | @example: |
| 509 | @see also: |
| 510 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 511 | void htc_dump_credit_states(HTC_HANDLE HTCHandle); |
| 512 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 513 | @desc: Indicate a traffic activity change on an endpoint |
| 514 | @function name: htc_indicate_activity_change |
| 515 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 516 | Endpoint - endpoint in which activity has changed |
| 517 | Active - true if active, false if it has become inactive |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 518 | @output: |
| 519 | @return: |
| 520 | @notes: This triggers the registered credit distribution function to |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 521 | re-adjust credits for active/inactive endpoints. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 522 | @example: |
| 523 | @see also: |
| 524 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 525 | void htc_indicate_activity_change(HTC_HANDLE HTCHandle, |
| 526 | HTC_ENDPOINT_ID Endpoint, A_BOOL Active); |
| 527 | |
| 528 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 529 | @desc: Get endpoint statistics |
| 530 | @function name: htc_get_endpoint_statistics |
| 531 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 532 | Endpoint - Endpoint identifier |
| 533 | Action - action to take with statistics |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 534 | @output: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 535 | pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 536 | |
| 537 | @return: true if statistics profiling is enabled, otherwise false. |
| 538 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 539 | @notes : Statistics is a compile-time option and this function may return |
| 540 | false if HTC is not compiled with profiling. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 541 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 542 | The caller can specify the statistic "action" to take when sampling |
| 543 | the statistics. This includes : |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 544 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 545 | HTC_EP_STAT_SAMPLE : The pStats structure is filled with the current |
| 546 | values. |
| 547 | HTC_EP_STAT_SAMPLE_AND_CLEAR : The structure is filled and the current |
| 548 | statisticsare cleared. |
| 549 | |
| 550 | HTC_EP_STAT_CLEA : the statistics are cleared, the called can pass a NULL |
| 551 | value forpStats |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 552 | |
| 553 | @example: |
| 554 | @see also: |
| 555 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 556 | A_BOOL htc_get_endpoint_statistics(HTC_HANDLE HTCHandle, |
| 557 | HTC_ENDPOINT_ID Endpoint, |
| 558 | HTC_ENDPOINT_STAT_ACTION Action, |
| 559 | HTC_ENDPOINT_STATS *pStats); |
| 560 | |
| 561 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 562 | @desc: Unblock HTC message reception |
| 563 | @function name: htc_unblock_recv |
| 564 | @input: HTCHandle - HTC handle |
| 565 | @output: |
| 566 | @return: |
| 567 | @notes: |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 568 | HTC will block the receiver if the EpRecvAlloc callback fails to provide a |
| 569 | packet. The caller can use this API to indicate to HTC when resources |
| 570 | (buffers) are available such that the receiver can be unblocked and HTC |
| 571 | may re-attempt fetching the pending message. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 572 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 573 | This API is not required if the user uses the EpRecvRefill callback or uses |
| 574 | the HTCAddReceivePacket()API to recycle or provide receive packets to HTC. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 575 | |
| 576 | @example: |
| 577 | @see also: |
| 578 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 579 | void htc_unblock_recv(HTC_HANDLE HTCHandle); |
| 580 | |
| 581 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 582 | @desc: send a series of HTC packets |
| 583 | @function name: htc_send_pkts_multiple |
| 584 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 585 | pPktQueue - local queue holding packets to send |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 586 | @output: |
| 587 | @return: A_OK |
| 588 | @notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro. |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 589 | The queue must only contain packets directed at the same endpoint. |
| 590 | Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order. |
| 591 | This API will remove the packets from the pkt queue and place them into the HTC Tx Queue |
| 592 | and bundle messages where possible. |
| 593 | The caller may allocate the pkt queue on the stack to hold the packets. |
| 594 | This interface is fully asynchronous. On error, htc_send_pkts will |
| 595 | call the registered Endpoint callback to cleanup the packet. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 596 | @example: |
| 597 | @see also: htc_flush_endpoint |
| 598 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 599 | A_STATUS htc_send_pkts_multiple(HTC_HANDLE HTCHandle, |
| 600 | HTC_PACKET_QUEUE *pPktQueue); |
| 601 | |
| 602 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 603 | @desc: Add multiple receive packets to HTC |
| 604 | @function name: htc_add_receive_pkt_multiple |
| 605 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 606 | pPktQueue - HTC receive packet queue holding packets to add |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 607 | @output: |
| 608 | @return: A_OK on success |
| 609 | @notes: user must supply HTC packets for capturing incomming HTC frames. The caller |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 610 | must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL() |
| 611 | macro. The queue must only contain recv packets for the same endpoint. |
| 612 | Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet. |
| 613 | This API will remove the packets from the pkt queue and place them into internal |
| 614 | recv packet list. |
| 615 | The caller may allocate the pkt queue on the stack to hold the packets. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 616 | @example: |
| 617 | @see also: |
| 618 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 619 | A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle, |
| 620 | HTC_PACKET_QUEUE *pPktQueue); |
| 621 | |
| 622 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 623 | @desc: Check if an endpoint is marked active |
| 624 | @function name: htc_is_endpoint_active |
| 625 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 626 | Endpoint - endpoint to check for active state |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 627 | @output: |
| 628 | @return: returns true if Endpoint is Active |
| 629 | @notes: |
| 630 | @example: |
| 631 | @see also: |
| 632 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 633 | A_BOOL htc_is_endpoint_active(HTC_HANDLE HTCHandle, |
| 634 | HTC_ENDPOINT_ID Endpoint); |
| 635 | |
| 636 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 637 | @desc: Get the number of recv buffers currently queued into an HTC endpoint |
| 638 | @function name: htc_get_num_recv_buffers |
| 639 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 640 | Endpoint - endpoint to check |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 641 | @output: |
| 642 | @return: returns number of buffers in queue |
| 643 | @notes: |
| 644 | @example: |
| 645 | @see also: |
| 646 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 647 | int htc_get_num_recv_buffers(HTC_HANDLE HTCHandle, |
| 648 | HTC_ENDPOINT_ID Endpoint); |
| 649 | |
| 650 | /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 651 | @desc: Set the target failure handling callback in HTC layer |
| 652 | @function name: htc_set_target_failure_callback |
| 653 | @input: HTCHandle - HTC handle |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 654 | Callback - target failure handling callback |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 655 | @output: |
| 656 | @return: |
| 657 | @notes: |
| 658 | @example: |
| 659 | @see also: |
| 660 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ |
| 661 | void htc_set_target_failure_callback(HTC_HANDLE HTCHandle, |
| 662 | HTC_TARGET_FAILURE Callback); |
| 663 | |
| 664 | /* internally used functions for testing... */ |
| 665 | void htc_enable_recv(HTC_HANDLE HTCHandle); |
| 666 | void htc_disable_recv(HTC_HANDLE HTCHandle); |
| 667 | A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle, |
| 668 | A_UINT32 TimeoutInMs, |
| 669 | A_BOOL *pbIsRecvPending); |
| 670 | |
| 671 | /* function to fetch stats from htc layer*/ |
| 672 | struct ol_ath_htc_stats *ieee80211_ioctl_get_htc_stats(HTC_HANDLE |
| 673 | HTCHandle); |
| 674 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 675 | #ifdef HIF_USB |
| 676 | #define HTCReturnReceivePkt(target, p, osbuf) \ |
| 677 | do { \ |
| 678 | A_NETBUF_FREE(osbuf); \ |
| 679 | if (p->Status == A_CLONE) { \ |
| 680 | qdf_mem_free(p); \ |
| 681 | } \ |
| 682 | } while (0) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 683 | #else |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 684 | #define HTCReturnReceivePkt(target, p, osbuf) htc_add_receive_pkt(target, p) |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 685 | #endif |
| 686 | |
| 687 | #ifdef WLAN_FEATURE_FASTPATH |
| 688 | #define HTC_TX_DESC_FILL(_htc_tx_desc, _download_len, _ep_id, _seq_no) \ |
| 689 | do { \ |
| 690 | HTC_WRITE32((_htc_tx_desc), \ |
| 691 | SM((_download_len), HTC_FRAME_HDR_PAYLOADLEN) | \ |
| 692 | SM((_ep_id), HTC_FRAME_HDR_ENDPOINTID)); \ |
| 693 | \ |
| 694 | HTC_WRITE32((A_UINT32 *)(_htc_tx_desc) + 1, \ |
| 695 | SM((_seq_no), HTC_FRAME_HDR_CONTROLBYTES1));\ |
| 696 | } while (0) |
| 697 | #endif /* WLAN_FEATURE_FASTPATH */ |
| 698 | |
| 699 | #ifdef __cplusplus |
| 700 | } |
| 701 | #endif |
| 702 | void htc_get_control_endpoint_tx_host_credits(HTC_HANDLE HTCHandle, int *credit); |
| 703 | void htc_dump_counter_info(HTC_HANDLE HTCHandle); |
| 704 | void *htc_get_targetdef(HTC_HANDLE htc_handle); |
Houston Hoffman | 47e387b | 2015-10-20 17:04:42 -0700 | [diff] [blame] | 705 | int htc_runtime_suspend(void); |
| 706 | int htc_runtime_resume(void); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 707 | |
| 708 | /* Disable ASPM : Disable PCIe low power */ |
Komal Seelam | f860068 | 2016-02-02 18:17:13 +0530 | [diff] [blame] | 709 | bool htc_can_suspend_link(HTC_HANDLE HTCHandle); |
| 710 | void htc_vote_link_down(HTC_HANDLE HTCHandle); |
| 711 | void htc_vote_link_up(HTC_HANDLE HTCHandle); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 712 | #ifdef IPA_OFFLOAD |
| 713 | void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 714 | qdf_dma_addr_t *ce_sr_base_paddr, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 715 | uint32_t *ce_sr_ring_size, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 716 | qdf_dma_addr_t *ce_reg_paddr); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 717 | #else |
| 718 | #define htc_ipa_get_ce_resource(htc_handle, \ |
| 719 | ce_sr_base_paddr, \ |
| 720 | ce_sr_ring_size, \ |
| 721 | ce_reg_paddr) /* NO-OP */ |
| 722 | #endif /* IPA_OFFLOAD */ |
| 723 | #endif /* _HTC_API_H_ */ |