#define BAUD_TIMEOUT_MS 1
#define BTPWRSAV_TIMEOUT_MS 1
-typedef struct {
+struct gmbox_proto_hci_uart {
HCI_TRANSPORT_CONFIG_INFO HCIConfig;
bool HCIAttached;
bool HCIStopped;
int CreditSize;
int CreditsCurrentSeek;
int SendProcessCount;
-} GMBOX_PROTO_HCI_UART;
+};
#define LOCK_HCI_RX(t) A_MUTEX_LOCK(&(t)->HCIRxLock);
#define UNLOCK_HCI_RX(t) A_MUTEX_UNLOCK(&(t)->HCIRxLock);
(p)->HCIConfig.pHCISendComplete((p)->HCIConfig.pContext, (pt)); \
}
-static int HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, bool Synchronous);
+static int HCITrySend(struct gmbox_proto_hci_uart *pProt, HTC_PACKET *pPacket, bool Synchronous);
-static void HCIUartCleanup(GMBOX_PROTO_HCI_UART *pProtocol)
+static void HCIUartCleanup(struct gmbox_proto_hci_uart *pProtocol)
{
A_ASSERT(pProtocol != NULL);
A_FREE(pProtocol);
}
-static int InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
+static int InitTxCreditState(struct gmbox_proto_hci_uart *pProt)
{
int status;
int credits;
static int CreditsAvailableCallback(void *pContext, int Credits, bool CreditIRQEnabled)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
bool enableCreditIrq = false;
bool disableCreditIrq = false;
bool doPendingSends = false;
return status;
}
-static INLINE void NotifyTransportFailure(GMBOX_PROTO_HCI_UART *pProt, int status)
+static INLINE void NotifyTransportFailure(struct gmbox_proto_hci_uart *pProt, int status)
{
if (pProt->HCIConfig.TransportFailure != NULL) {
pProt->HCIConfig.TransportFailure(pProt->HCIConfig.pContext, status);
static void FailureCallback(void *pContext, int Status)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
/* target assertion occured */
NotifyTransportFailure(pProt, Status);
static void StateDumpCallback(void *pContext)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("============ HCIUart State ======================\n"));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("RecvStateFlags : 0x%X \n",pProt->RecvStateFlags));
static int HCIUartMessagePending(void *pContext, u8 LookAheadBytes[], int ValidBytes)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
int status = 0;
int totalRecvLength = 0;
HCI_TRANSPORT_PACKET_TYPE pktType = HCI_PACKET_INVALID;
static void HCISendPacketCompletion(void *Context, HTC_PACKET *pPacket)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)Context;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)Context;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion (pPacket:0x%lX) \n",(unsigned long)pPacket));
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion \n"));
}
-static int SeekCreditsSynch(GMBOX_PROTO_HCI_UART *pProt)
+static int SeekCreditsSynch(struct gmbox_proto_hci_uart *pProt)
{
int status = 0;
int credits;
return status;
}
-static int HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, bool Synchronous)
+static int HCITrySend(struct gmbox_proto_hci_uart *pProt, HTC_PACKET *pPacket, bool Synchronous)
{
int status = 0;
int transferLength;
return status;
}
-static void FlushSendQueue(GMBOX_PROTO_HCI_UART *pProt)
+static void FlushSendQueue(struct gmbox_proto_hci_uart *pProt)
{
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE discardQueue;
}
-static void FlushRecvBuffers(GMBOX_PROTO_HCI_UART *pProt)
+static void FlushRecvBuffers(struct gmbox_proto_hci_uart *pProt)
{
HTC_PACKET_QUEUE discardQueue;
HTC_PACKET *pPacket;
int GMboxProtocolInstall(struct ar6k_device *pDev)
{
int status = 0;
- GMBOX_PROTO_HCI_UART *pProtocol = NULL;
+ struct gmbox_proto_hci_uart *pProtocol = NULL;
do {
- pProtocol = A_MALLOC(sizeof(GMBOX_PROTO_HCI_UART));
+ pProtocol = A_MALLOC(sizeof(struct gmbox_proto_hci_uart));
if (NULL == pProtocol) {
status = A_NO_MEMORY;
/*** protocol module uninstall entry point ***/
void GMboxProtocolUninstall(struct ar6k_device *pDev)
{
- GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev);
+ struct gmbox_proto_hci_uart *pProtocol = (struct gmbox_proto_hci_uart *)DEV_GMBOX_GET_PROTOCOL(pDev);
if (pProtocol != NULL) {
}
-static int NotifyTransportReady(GMBOX_PROTO_HCI_UART *pProt)
+static int NotifyTransportReady(struct gmbox_proto_hci_uart *pProt)
{
HCI_TRANSPORT_PROPERTIES props;
int status = 0;
HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo)
{
- GMBOX_PROTO_HCI_UART *pProtocol = NULL;
+ struct gmbox_proto_hci_uart *pProtocol = NULL;
struct ar6k_device *pDev;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportAttach \n"));
do {
- pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev);
+ pProtocol = (struct gmbox_proto_hci_uart *)DEV_GMBOX_GET_PROTOCOL(pDev);
if (NULL == pProtocol) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("GMBOX protocol not installed! \n"));
void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans)
{
- GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProtocol = (struct gmbox_proto_hci_uart *)HciTrans;
struct ar6k_device *pDev = pProtocol->pDev;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportDetach \n"));
int HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
int status = 0;
bool unblockRecv = false;
HTC_PACKET *pPacket;
int HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, bool Synchronous)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
return HCITrySend(pProt,pPacket,Synchronous);
}
void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStop \n"));
int HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans)
{
int status;
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStart \n"));
int HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, bool Enable)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
return DevGMboxIRQAction(pProt->pDev,
Enable ? GMBOX_RECV_IRQ_ENABLE : GMBOX_RECV_IRQ_DISABLE,
PROC_IO_SYNC);
HTC_PACKET *pPacket,
int MaxPollMS)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
int status = 0;
u8 lookAhead[8];
int bytes;
#define MSB_SCRATCH_IDX 5
int HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, u32 Baud)
{
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
HIF_DEVICE *pHIFDevice = (HIF_DEVICE *)(pProt->pDev->HIFDevice);
u32 scaledBaud, scratchAddr;
int status = 0;
int HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, bool Enable)
{
int status;
- GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
+ struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
if (Enable) {
status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_PWR_SAV_ON, BTPWRSAV_TIMEOUT_MS);