#endif
static void HTCReportFailure(void *Context);
-static void ResetEndpointStates(HTC_TARGET *target);
+static void ResetEndpointStates(struct htc_target *target);
-void HTCFreeControlBuffer(HTC_TARGET *target, struct htc_packet *pPacket, struct htc_packet_queue *pList)
+void HTCFreeControlBuffer(struct htc_target *target, struct htc_packet *pPacket, struct htc_packet_queue *pList)
{
LOCK_HTC(target);
HTC_PACKET_ENQUEUE(pList,pPacket);
UNLOCK_HTC(target);
}
-struct htc_packet *HTCAllocControlBuffer(HTC_TARGET *target, struct htc_packet_queue *pList)
+struct htc_packet *HTCAllocControlBuffer(struct htc_target *target, struct htc_packet_queue *pList)
{
struct htc_packet *pPacket;
}
/* cleanup the HTC instance */
-static void HTCCleanup(HTC_TARGET *target)
+static void HTCCleanup(struct htc_target *target)
{
s32 i;
/* registered target arrival callback from the HIF layer */
HTC_HANDLE HTCCreate(void *hif_handle, struct htc_init_info *pInfo)
{
- HTC_TARGET *target = NULL;
+ struct htc_target *target = NULL;
int status = 0;
int i;
u32 ctrl_bufsz;
do {
/* allocate target memory */
- if ((target = (HTC_TARGET *)A_MALLOC(sizeof(HTC_TARGET))) == NULL) {
+ if ((target = (struct htc_target *)A_MALLOC(sizeof(struct htc_target))) == NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to allocate memory\n"));
status = A_ERROR;
break;
}
- A_MEMZERO(target, sizeof(HTC_TARGET));
+ A_MEMZERO(target, sizeof(struct htc_target));
A_MUTEX_INIT(&target->HTCLock);
A_MUTEX_INIT(&target->HTCRxLock);
A_MUTEX_INIT(&target->HTCTxLock);
void HTCDestroy(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCDestroy .. Destroying :0x%lX \n",(unsigned long)target));
HTCCleanup(target);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCDestroy \n"));
* HIF requests */
void *HTCGetHifDevice(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return target->Device.HIFDevice;
}
* this operation is fully synchronous and the message is polled for */
int HTCWaitTarget(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int status;
struct htc_packet *pPacket = NULL;
HTC_READY_EX_MSG *pRdyMsg;
/* Start HTC, enable interrupts and let the target know host has finished setup */
int HTCStart(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_packet *pPacket;
int status;
return status;
}
-static void ResetEndpointStates(HTC_TARGET *target)
+static void ResetEndpointStates(struct htc_target *target)
{
struct htc_endpoint *pEndpoint;
int i;
/* stop HTC communications, i.e. stop interrupt reception, and flush all queued buffers */
void HTCStop(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCStop \n"));
LOCK_HTC(target);
#ifdef ATH_DEBUG_MODULE
void HTCDumpCreditStates(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
LOCK_HTC_TX(target);
* which uses a mechanism to report errors from the target (i.e. special interrupts) */
static void HTCReportFailure(void *Context)
{
- HTC_TARGET *target = (HTC_TARGET *)Context;
+ struct htc_target *target = (struct htc_target *)Context;
target->TargetFailure = true;
{
#ifdef HTC_EP_STAT_PROFILING
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
bool clearStats = false;
bool sample = false;
struct ar6k_device *HTCGetAR6KDevice(void *HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return &target->Device;
}
int TxProcessCount; /* reference count to continue tx processing */
struct htc_packet_queue RecvIndicationQueue; /* recv packets ready to be indicated */
int RxProcessCount; /* reference count to allow single processing context */
- struct _HTC_TARGET *target; /* back pointer to target */
+ struct htc_target *target; /* back pointer to target */
u8 SeqNo; /* TX seq no (helpful) for debugging */
u32 LocalConnectionFlags; /* local connection flags */
#ifdef HTC_EP_STAT_PROFILING
#define HTC_OP_STATE_STOPPING (1 << 0)
/* our HTC target state */
-typedef struct _HTC_TARGET {
+struct htc_target {
struct htc_endpoint EndPoint[ENDPOINT_MAX];
struct htc_control_buffer HTCControlBuffers[NUM_CONTROL_BUFFERS];
struct htc_endpoint_credit_dist *EpCreditDistributionListHead;
int MaxMsgPerBundle; /* max messages per bundle for HTC */
bool SendBundlingEnabled; /* run time enable for send bundling (dynamic) */
int RecvBundlingEnabled; /* run time enable for recv bundling (dynamic) */
-} HTC_TARGET;
+};
#define HTC_STOPPING(t) ((t)->OpStateFlags & HTC_OP_STATE_STOPPING)
#define LOCK_HTC(t) A_MUTEX_LOCK(&(t)->HTCLock);
#define LOCK_HTC_TX(t) A_MUTEX_LOCK(&(t)->HTCTxLock);
#define UNLOCK_HTC_TX(t) A_MUTEX_UNLOCK(&(t)->HTCTxLock);
-#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))
+#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((struct htc_target *)(hnd))
#define HTC_RECYCLE_RX_PKT(target,p,e) \
{ \
if ((p)->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_NO_RECYCLE) { \
/* internal HTC functions */
void HTCControlTxComplete(void *Context, struct htc_packet *pPacket);
void HTCControlRecv(void *Context, struct htc_packet *pPacket);
-int HTCWaitforControlMessage(HTC_TARGET *target, struct htc_packet **ppControlPacket);
-struct htc_packet *HTCAllocControlBuffer(HTC_TARGET *target, struct htc_packet_queue *pList);
-void HTCFreeControlBuffer(HTC_TARGET *target, struct htc_packet *pPacket, struct htc_packet_queue *pList);
-int HTCIssueSend(HTC_TARGET *target, struct htc_packet *pPacket);
+int HTCWaitforControlMessage(struct htc_target *target, struct htc_packet **ppControlPacket);
+struct htc_packet *HTCAllocControlBuffer(struct htc_target *target, struct htc_packet_queue *pList);
+void HTCFreeControlBuffer(struct htc_target *target, struct htc_packet *pPacket, struct htc_packet_queue *pList);
+int HTCIssueSend(struct htc_target *target, struct htc_packet *pPacket);
void HTCRecvCompleteHandler(void *Context, struct htc_packet *pPacket);
int HTCRecvMessagePendingHandler(void *Context, u32 MsgLookAheads[], int NumLookAheads, bool *pAsyncProc, int *pNumPktsFetched);
-void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
-int HTCSendSetupComplete(HTC_TARGET *target);
-void HTCFlushRecvBuffers(HTC_TARGET *target);
-void HTCFlushSendPkts(HTC_TARGET *target);
+void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
+int HTCSendSetupComplete(struct htc_target *target);
+void HTCFlushRecvBuffers(struct htc_target *target);
+void HTCFlushSendPkts(struct htc_target *target);
#ifdef ATH_DEBUG_MODULE
void DumpCreditDist(struct htc_endpoint_credit_dist *pEPDist);
-void DumpCreditDistStates(HTC_TARGET *target);
+void DumpCreditDistStates(struct htc_target *target);
void DebugDumpBytes(u8 *buffer, u16 length, char *pDescription);
#endif
-static INLINE struct htc_packet *HTC_ALLOC_CONTROL_TX(HTC_TARGET *target) {
+static INLINE struct htc_packet *HTC_ALLOC_CONTROL_TX(struct htc_target *target) {
struct htc_packet *pPacket = HTCAllocControlBuffer(target,&target->ControlBufferTXFreeList);
if (pPacket != NULL) {
/* set payload pointer area with some headroom */
}
-static INLINE int HTCProcessTrailer(HTC_TARGET *target,
+static INLINE int HTCProcessTrailer(struct htc_target *target,
u8 *pBuffer,
int Length,
u32 *pNextLookAheads,
/* process a received message (i.e. strip off header, process any trailer data)
* note : locks must be released when this function is called */
-static int HTCProcessRecvHeader(HTC_TARGET *target,
+static int HTCProcessRecvHeader(struct htc_target *target,
struct htc_packet *pPacket,
u32 *pNextLookAheads,
int *pNumLookAheads)
return status;
}
-static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
+static INLINE void HTCAsyncRecvCheckMorePackets(struct htc_target *target,
u32 NextLookAheads[],
int NumLookAheads,
bool CheckMoreMsgs)
}
/* unload the recv completion queue */
-static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, struct htc_endpoint *pEndpoint)
+static INLINE void DrainRecvIndicationQueue(struct htc_target *target, struct htc_endpoint *pEndpoint)
{
struct htc_packet_queue recvCompletions;
* completes a read request, it will call this completion handler */
void HTCRecvCompleteHandler(void *Context, struct htc_packet *pPacket)
{
- HTC_TARGET *target = (HTC_TARGET *)Context;
+ struct htc_target *target = (struct htc_target *)Context;
struct htc_endpoint *pEndpoint;
u32 nextLookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
int numLookAheads = 0;
/* synchronously wait for a control message from the target,
* This function is used at initialization time ONLY. At init messages
* on ENDPOINT 0 are expected. */
-int HTCWaitforControlMessage(HTC_TARGET *target, struct htc_packet **ppControlPacket)
+int HTCWaitforControlMessage(struct htc_target *target, struct htc_packet **ppControlPacket)
{
int status;
u32 lookAhead;
return status;
}
-static int AllocAndPrepareRxPackets(HTC_TARGET *target,
+static int AllocAndPrepareRxPackets(struct htc_target *target,
u32 LookAheads[],
int Messages,
struct htc_endpoint *pEndpoint,
struct htc_endpoint *pEndpoint;
u32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
int numLookAheads = 0;
- HTC_TARGET *target = (HTC_TARGET *)pScatterReq->Context;
+ struct htc_target *target = (struct htc_target *)pScatterReq->Context;
int status;
bool partialBundle = false;
struct htc_packet_queue localRecvQueue;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCAsyncRecvScatterCompletion \n"));
}
-static int HTCIssueRecvPacketBundle(HTC_TARGET *target,
+static int HTCIssueRecvPacketBundle(struct htc_target *target,
struct htc_packet_queue *pRecvPktQueue,
struct htc_packet_queue *pSyncCompletionQueue,
int *pNumPacketsFetched,
/* callback when device layer or lookahead report parsing detects a pending message */
int HTCRecvMessagePendingHandler(void *Context, u32 MsgLookAheads[], int NumLookAheads, bool *pAsyncProc, int *pNumPktsFetched)
{
- HTC_TARGET *target = (HTC_TARGET *)Context;
+ struct htc_target *target = (struct htc_target *)Context;
int status = 0;
struct htc_packet *pPacket;
struct htc_endpoint *pEndpoint;
int HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint;
bool unblockRecv = false;
int status = 0;
void HTCUnblockRecv(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
bool unblockRecv = false;
LOCK_HTC_RX(target);
}
}
-static void HTCFlushRxQueue(HTC_TARGET *target, struct htc_endpoint *pEndpoint, struct htc_packet_queue *pQueue)
+static void HTCFlushRxQueue(struct htc_target *target, struct htc_endpoint *pEndpoint, struct htc_packet_queue *pQueue)
{
struct htc_packet *pPacket;
struct htc_packet_queue container;
UNLOCK_HTC_RX(target);
}
-static void HTCFlushEndpointRX(HTC_TARGET *target, struct htc_endpoint *pEndpoint)
+static void HTCFlushEndpointRX(struct htc_target *target, struct htc_endpoint *pEndpoint)
{
/* flush any recv indications not already made */
HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RecvIndicationQueue);
HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RxBuffers);
}
-void HTCFlushRecvBuffers(HTC_TARGET *target)
+void HTCFlushRecvBuffers(struct htc_target *target)
{
struct htc_endpoint *pEndpoint;
int i;
void HTCEnableRecv(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
if (!HTC_STOPPING(target)) {
/* re-enable */
void HTCDisableRecv(HTC_HANDLE HTCHandle)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
if (!HTC_STOPPING(target)) {
/* disable */
int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return HTC_PACKET_QUEUE_DEPTH(&(target->EndPoint[Endpoint].RxBuffers));
}
bool *pbIsRecvPending)
{
int status = 0;
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
status = DevWaitForPendingRecv(&target->Device,
TimeoutInMs,
}
/* do final completion on sent packet */
-static INLINE void CompleteSentPacket(HTC_TARGET *target, struct htc_endpoint *pEndpoint, struct htc_packet *pPacket)
+static INLINE void CompleteSentPacket(struct htc_target *target, struct htc_endpoint *pEndpoint, struct htc_packet *pPacket)
{
pPacket->Completion = NULL;
* layer */
static void HTCSendPktCompletionHandler(void *Context, struct htc_packet *pPacket)
{
- HTC_TARGET *target = (HTC_TARGET *)Context;
+ struct htc_target *target = (struct htc_target *)Context;
struct htc_endpoint *pEndpoint = &target->EndPoint[pPacket->Endpoint];
struct htc_packet_queue container;
DO_EP_TX_COMPLETION(pEndpoint,&container);
}
-int HTCIssueSend(HTC_TARGET *target, struct htc_packet *pPacket)
+int HTCIssueSend(struct htc_target *target, struct htc_packet *pPacket)
{
int status;
bool sync = false;
}
/* get HTC send packets from the TX queue on an endpoint */
-static INLINE void GetHTCSendPackets(HTC_TARGET *target,
+static INLINE void GetHTCSendPackets(struct htc_target *target,
struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueue)
{
int i;
struct htc_packet *pPacket;
struct htc_endpoint *pEndpoint = (struct htc_endpoint *)pScatterReq->Context;
- HTC_TARGET *target = (HTC_TARGET *)pEndpoint->target;
+ struct htc_target *target = (struct htc_target *)pEndpoint->target;
int status = 0;
struct htc_packet_queue sendCompletes;
bool done = false;
int bundlesSent = 0;
int totalPktsInBundle = 0;
- HTC_TARGET *target = pEndpoint->target;
+ struct htc_target *target = pEndpoint->target;
int creditRemainder = 0;
int creditPad;
/*
* if there are no credits, the packet(s) remains in the queue.
* this function returns the result of the attempt to send a queue of HTC packets */
-static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
+static HTC_SEND_QUEUE_RESULT HTCTrySend(struct htc_target *target,
struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pCallersSendQueue)
{
int HTCSendPktsMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint;
struct htc_packet *pPacket;
}
/* check TX queues to drain because of credit distribution update */
-static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target)
+static INLINE void HTCCheckEndpointTxQueues(struct htc_target *target)
{
struct htc_endpoint *pEndpoint;
struct htc_endpoint_credit_dist *pDistItem;
}
/* process credit reports and call distribution function */
-void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint)
+void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint)
{
int i;
struct htc_endpoint *pEndpoint;
}
/* flush endpoint TX queue */
-static void HTCFlushEndpointTX(HTC_TARGET *target, struct htc_endpoint *pEndpoint, HTC_TX_TAG Tag)
+static void HTCFlushEndpointTX(struct htc_target *target, struct htc_endpoint *pEndpoint, HTC_TX_TAG Tag)
{
struct htc_packet *pPacket;
struct htc_packet_queue discardQueue;
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("----------------------------------------------------\n"));
}
-void DumpCreditDistStates(HTC_TARGET *target)
+void DumpCreditDistStates(struct htc_target *target)
{
struct htc_endpoint_credit_dist *pEPList = target->EpCreditDistributionListHead;
}
/* flush all send packets from all endpoint queues */
-void HTCFlushSendPkts(HTC_TARGET *target)
+void HTCFlushSendPkts(struct htc_target *target)
{
struct htc_endpoint *pEndpoint;
int i;
/* HTC API to flush an endpoint's TX queue*/
void HTCFlushEndpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG Tag)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
if (pEndpoint->ServiceID == 0) {
HTC_ENDPOINT_ID Endpoint,
bool Active)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
bool doDist = false;
bool HTCIsEndpointActive(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
if (pEndpoint->ServiceID == 0) {
if (pPacket->Status == A_ECANCELED) {
/* this is a flush operation, return the control packet back to the pool */
- HTC_FREE_CONTROL_RX((HTC_TARGET*)Context,pPacket);
+ HTC_FREE_CONTROL_RX((struct htc_target*)Context,pPacket);
return;
}
#endif
}
- HTC_RECYCLE_RX_PKT((HTC_TARGET*)Context,pPacket,&((HTC_TARGET*)Context)->EndPoint[0]);
+ HTC_RECYCLE_RX_PKT((struct htc_target*)Context,pPacket,&((struct htc_target*)Context)->EndPoint[0]);
}
-int HTCSendSetupComplete(HTC_TARGET *target)
+int HTCSendSetupComplete(struct htc_target *target)
{
struct htc_packet *pSendPacket = NULL;
int status;
struct htc_service_connect_req *pConnectReq,
struct htc_service_connect_resp *pConnectResp)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int status = 0;
struct htc_packet *pRecvPacket = NULL;
struct htc_packet *pSendPacket = NULL;
return status;
}
-static void AddToEndpointDistList(HTC_TARGET *target, struct htc_endpoint_credit_dist *pEpDist)
+static void AddToEndpointDistList(struct htc_target *target, struct htc_endpoint_credit_dist *pEpDist)
{
struct htc_endpoint_credit_dist *pCurEntry,*pLastEntry;
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength)
{
- HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
+ struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int i;
int ep;