diff options
Diffstat (limited to 'drivers/staging/ath6kl/miscdrv')
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/ar3kconfig.c | 182 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c | 164 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h | 8 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c | 142 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h | 26 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/common_drv.c | 309 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/credit_dist.c | 46 | ||||
-rw-r--r-- | drivers/staging/ath6kl/miscdrv/miscdrv.h | 2 |
8 files changed, 435 insertions, 444 deletions
diff --git a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c index 83bc5be..4f18f43 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kconfig.c @@ -47,24 +47,24 @@ #define HCI_MAX_EVT_RECV_LENGTH 257 #define EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET 5 -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev); +int AthPSInitialize(struct ar3k_config_info *hdev); -static A_STATUS SendHCICommand(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pBuffer, +static int SendHCICommand(struct ar3k_config_info *pConfig, + u8 *pBuffer, int Length) { - HTC_PACKET *pPacket = NULL; - A_STATUS status = A_OK; + struct htc_packet *pPacket = NULL; + int status = 0; do { - pPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET)); + pPacket = (struct htc_packet *)A_MALLOC(sizeof(struct htc_packet)); if (NULL == pPacket) { status = A_NO_MEMORY; break; } - A_MEMZERO(pPacket,sizeof(HTC_PACKET)); + A_MEMZERO(pPacket,sizeof(struct htc_packet)); SET_HTC_PACKET_INFO_TX(pPacket, NULL, pBuffer, @@ -73,9 +73,9 @@ static A_STATUS SendHCICommand(AR3K_CONFIG_INFO *pConfig, AR6K_CONTROL_PKT_TAG); /* issue synchronously */ - status = HCI_TransportSendPkt(pConfig->pHCIDev,pPacket,TRUE); + status = HCI_TransportSendPkt(pConfig->pHCIDev,pPacket,true); - } while (FALSE); + } while (false); if (pPacket != NULL) { A_FREE(pPacket); @@ -84,36 +84,36 @@ static A_STATUS SendHCICommand(AR3K_CONFIG_INFO *pConfig, return status; } -static A_STATUS RecvHCIEvent(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pBuffer, +static int RecvHCIEvent(struct ar3k_config_info *pConfig, + u8 *pBuffer, int *pLength) { - A_STATUS status = A_OK; - HTC_PACKET *pRecvPacket = NULL; + int status = 0; + struct htc_packet *pRecvPacket = NULL; do { - pRecvPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET)); + pRecvPacket = (struct htc_packet *)A_MALLOC(sizeof(struct htc_packet)); if (NULL == pRecvPacket) { status = A_NO_MEMORY; AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to alloc HTC struct \n")); break; } - A_MEMZERO(pRecvPacket,sizeof(HTC_PACKET)); + A_MEMZERO(pRecvPacket,sizeof(struct htc_packet)); SET_HTC_PACKET_INFO_RX_REFILL(pRecvPacket,NULL,pBuffer,*pLength,HCI_EVENT_TYPE); status = HCI_TransportRecvHCIEventSync(pConfig->pHCIDev, pRecvPacket, HCI_EVENT_RESP_TIMEOUTMS); - if (A_FAILED(status)) { + if (status) { break; } *pLength = pRecvPacket->ActualLength; - } while (FALSE); + } while (false); if (pRecvPacket != NULL) { A_FREE(pRecvPacket); @@ -122,18 +122,18 @@ static A_STATUS RecvHCIEvent(AR3K_CONFIG_INFO *pConfig, return status; } -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, +int SendHCICommandWaitCommandComplete(struct ar3k_config_info *pConfig, + u8 *pHCICommand, int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree) + u8 **ppEventBuffer, + u8 **ppBufferToFree) { - A_STATUS status = A_OK; - A_UINT8 *pBuffer = NULL; - A_UINT8 *pTemp; + int status = 0; + u8 *pBuffer = NULL; + u8 *pTemp; int length; - A_BOOL commandComplete = FALSE; - A_UINT8 opCodeBytes[2]; + bool commandComplete = false; + u8 opCodeBytes[2]; do { @@ -141,7 +141,7 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, length += pConfig->pHCIProps->HeadRoom + pConfig->pHCIProps->TailRoom; length += pConfig->pHCIProps->IOBlockPad; - pBuffer = (A_UINT8 *)A_MALLOC(length); + pBuffer = (u8 *)A_MALLOC(length); if (NULL == pBuffer) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Failed to allocate bt buffer \n")); status = A_NO_MEMORY; @@ -153,12 +153,12 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, opCodeBytes[1] = pHCICommand[HCI_CMD_OPCODE_BYTE_HI_OFFSET]; /* copy HCI command */ - A_MEMCPY(pBuffer + pConfig->pHCIProps->HeadRoom,pHCICommand,CmdLength); + memcpy(pBuffer + pConfig->pHCIProps->HeadRoom,pHCICommand,CmdLength); /* send command */ status = SendHCICommand(pConfig, pBuffer + pConfig->pHCIProps->HeadRoom, CmdLength); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Failed to send HCI Command (%d) \n", status)); AR_DEBUG_PRINTBUF(pHCICommand,CmdLength,"HCI Bridge Failed HCI Command"); break; @@ -167,7 +167,7 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, /* reuse buffer to capture command complete event */ A_MEMZERO(pBuffer,length); status = RecvHCIEvent(pConfig,pBuffer,&length); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: HCI event recv failed \n")); AR_DEBUG_PRINTBUF(pHCICommand,CmdLength,"HCI Bridge Failed HCI Command"); break; @@ -177,7 +177,7 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, if (pTemp[0] == HCI_CMD_COMPLETE_EVENT_CODE) { if ((pTemp[HCI_EVENT_OPCODE_BYTE_LOW] == opCodeBytes[0]) && (pTemp[HCI_EVENT_OPCODE_BYTE_HI] == opCodeBytes[1])) { - commandComplete = TRUE; + commandComplete = true; } } @@ -200,7 +200,7 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, pBuffer = NULL; } - } while (FALSE); + } while (false); if (pBuffer != NULL) { A_FREE(pBuffer); @@ -209,27 +209,27 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, return status; } -static A_STATUS AR3KConfigureHCIBaud(AR3K_CONFIG_INFO *pConfig) +static int AR3KConfigureHCIBaud(struct ar3k_config_info *pConfig) { - A_STATUS status = A_OK; - A_UINT8 hciBaudChangeCommand[] = {0x0c,0xfc,0x2,0,0}; - A_UINT16 baudVal; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; + int status = 0; + u8 hciBaudChangeCommand[] = {0x0c,0xfc,0x2,0,0}; + u16 baudVal; + u8 *pEvent = NULL; + u8 *pBufferToFree = NULL; do { if (pConfig->Flags & AR3K_CONFIG_FLAG_SET_AR3K_BAUD) { - baudVal = (A_UINT16)(pConfig->AR3KBaudRate / 100); - hciBaudChangeCommand[3] = (A_UINT8)baudVal; - hciBaudChangeCommand[4] = (A_UINT8)(baudVal >> 8); + baudVal = (u16)(pConfig->AR3KBaudRate / 100); + hciBaudChangeCommand[3] = (u8)baudVal; + hciBaudChangeCommand[4] = (u8)(baudVal >> 8); status = SendHCICommandWaitCommandComplete(pConfig, hciBaudChangeCommand, sizeof(hciBaudChangeCommand), &pEvent, &pBufferToFree); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: Baud rate change failed! \n")); break; } @@ -255,7 +255,7 @@ static A_STATUS AR3KConfigureHCIBaud(AR3K_CONFIG_INFO *pConfig) /* Tell target to change UART baud rate for AR6K */ status = HCI_TransportSetBaudRate(pConfig->pHCIDev, pConfig->AR3KBaudRate); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR3K Config: failed to set scale and step values: %d \n", status)); break; @@ -265,7 +265,7 @@ static A_STATUS AR3KConfigureHCIBaud(AR3K_CONFIG_INFO *pConfig) ("AR3K Config: Baud changed to %d for AR6K\n", pConfig->AR3KBaudRate)); } - } while (FALSE); + } while (false); if (pBufferToFree != NULL) { A_FREE(pBufferToFree); @@ -274,13 +274,13 @@ static A_STATUS AR3KConfigureHCIBaud(AR3K_CONFIG_INFO *pConfig) return status; } -static A_STATUS AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig) +static int AR3KExitMinBoot(struct ar3k_config_info *pConfig) { - A_STATUS status; - A_CHAR exitMinBootCmd[] = {0x25,0xFC,0x0c,0x03,0x00,0x00,0x00,0x00,0x00,0x00, + int status; + char exitMinBootCmd[] = {0x25,0xFC,0x0c,0x03,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; + u8 *pEvent = NULL; + u8 *pBufferToFree = NULL; status = SendHCICommandWaitCommandComplete(pConfig, exitMinBootCmd, @@ -288,7 +288,7 @@ static A_STATUS AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig) &pEvent, &pBufferToFree); - if (A_SUCCESS(status)) { + if (!status) { if (pEvent[EXIT_MIN_BOOT_COMMAND_STATUS_OFFSET] != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("AR3K Config: MinBoot exit command event status failed: %d \n", @@ -310,12 +310,12 @@ static A_STATUS AR3KExitMinBoot(AR3K_CONFIG_INFO *pConfig) return status; } -static A_STATUS AR3KConfigureSendHCIReset(AR3K_CONFIG_INFO *pConfig) +static int AR3KConfigureSendHCIReset(struct ar3k_config_info *pConfig) { - A_STATUS status = A_OK; - A_UINT8 hciResetCommand[] = {0x03,0x0c,0x0}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; + int status = 0; + u8 hciResetCommand[] = {0x03,0x0c,0x0}; + u8 *pEvent = NULL; + u8 *pBufferToFree = NULL; status = SendHCICommandWaitCommandComplete( pConfig, hciResetCommand, @@ -323,7 +323,7 @@ static A_STATUS AR3KConfigureSendHCIReset(AR3K_CONFIG_INFO *pConfig) &pEvent, &pBufferToFree ); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR3K Config: HCI reset failed! \n")); } @@ -334,11 +334,11 @@ static A_STATUS AR3KConfigureSendHCIReset(AR3K_CONFIG_INFO *pConfig) return status; } -static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) +static int AR3KEnableTLPM(struct ar3k_config_info *pConfig) { - A_STATUS status; + int status; /* AR3K vendor specific command for Host Wakeup Config */ - A_CHAR hostWakeupConfig[] = {0x31,0xFC,0x18, + char hostWakeupConfig[] = {0x31,0xFC,0x18, 0x02,0x00,0x00,0x00, 0x01,0x00,0x00,0x00, TLPM_DEFAULT_IDLE_TIMEOUT_LSB,TLPM_DEFAULT_IDLE_TIMEOUT_MSB,0x00,0x00, //idle timeout in ms @@ -346,7 +346,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) TLPM_DEFAULT_WAKEUP_TIMEOUT_MS,0x00,0x00,0x00, //wakeup timeout in ms 0x00,0x00,0x00,0x00}; /* AR3K vendor specific command for Target Wakeup Config */ - A_CHAR targetWakeupConfig[] = {0x31,0xFC,0x18, + char targetWakeupConfig[] = {0x31,0xFC,0x18, 0x04,0x00,0x00,0x00, 0x01,0x00,0x00,0x00, TLPM_DEFAULT_IDLE_TIMEOUT_LSB,TLPM_DEFAULT_IDLE_TIMEOUT_MSB,0x00,0x00, //idle timeout in ms @@ -354,20 +354,20 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) TLPM_DEFAULT_WAKEUP_TIMEOUT_MS,0x00,0x00,0x00, //wakeup timeout in ms 0x00,0x00,0x00,0x00}; /* AR3K vendor specific command for Host Wakeup Enable */ - A_CHAR hostWakeupEnable[] = {0x31,0xFC,0x4, + char hostWakeupEnable[] = {0x31,0xFC,0x4, 0x01,0x00,0x00,0x00}; /* AR3K vendor specific command for Target Wakeup Enable */ - A_CHAR targetWakeupEnable[] = {0x31,0xFC,0x4, + char targetWakeupEnable[] = {0x31,0xFC,0x4, 0x06,0x00,0x00,0x00}; /* AR3K vendor specific command for Sleep Enable */ - A_CHAR sleepEnable[] = {0x4,0xFC,0x1, + char sleepEnable[] = {0x4,0xFC,0x1, 0x1}; - A_UINT8 *pEvent = NULL; - A_UINT8 *pBufferToFree = NULL; + u8 *pEvent = NULL; + u8 *pBufferToFree = NULL; if (0 != pConfig->IdleTimeout) { - A_UINT8 idle_lsb = pConfig->IdleTimeout & 0xFF; - A_UINT8 idle_msb = (pConfig->IdleTimeout & 0xFF00) >> 8; + u8 idle_lsb = pConfig->IdleTimeout & 0xFF; + u8 idle_msb = (pConfig->IdleTimeout & 0xFF00) >> 8; hostWakeupConfig[11] = targetWakeupConfig[11] = idle_lsb; hostWakeupConfig[12] = targetWakeupConfig[12] = idle_msb; } @@ -384,7 +384,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) if (pBufferToFree != NULL) { A_FREE(pBufferToFree); } - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Config Failed! \n")); return status; } @@ -399,7 +399,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) if (pBufferToFree != NULL) { A_FREE(pBufferToFree); } - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Config Failed! \n")); return status; } @@ -414,7 +414,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) if (pBufferToFree != NULL) { A_FREE(pBufferToFree); } - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HostWakeup Enable Failed! \n")); return status; } @@ -429,7 +429,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) if (pBufferToFree != NULL) { A_FREE(pBufferToFree); } - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Target Wakeup Enable Failed! \n")); return status; } @@ -444,7 +444,7 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) if (pBufferToFree != NULL) { A_FREE(pBufferToFree); } - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Sleep Enable Failed! \n")); } @@ -453,9 +453,9 @@ static A_STATUS AR3KEnableTLPM(AR3K_CONFIG_INFO *pConfig) return status; } -A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) +int AR3KConfigure(struct ar3k_config_info *pConfig) { - A_STATUS status = A_OK; + int status = 0; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Configuring AR3K ...\n")); @@ -467,21 +467,21 @@ A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) } /* disable asynchronous recv while we issue commands and receive events synchronously */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,FALSE); - if (A_FAILED(status)) { + status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,false); + if (status) { break; } if (pConfig->Flags & AR3K_CONFIG_FLAG_FORCE_MINBOOT_EXIT) { status = AR3KExitMinBoot(pConfig); - if (A_FAILED(status)) { + if (status) { break; } } /* Load patching and PST file if available*/ - if (A_OK != AthPSInitialize(pConfig)) { + if (0 != AthPSInitialize(pConfig)) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Patch Download Failed!\n")); } @@ -491,7 +491,7 @@ A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) if (pConfig->Flags & (AR3K_CONFIG_FLAG_SET_AR3K_BAUD | AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP)) { status = AR3KConfigureHCIBaud(pConfig); - if (A_FAILED(status)) { + if (status) { break; } } @@ -507,13 +507,13 @@ A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) } /* re-enable asynchronous recv */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,TRUE); - if (A_FAILED(status)) { + status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,true); + if (status) { break; } - } while (FALSE); + } while (false); AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Configuration Complete (status = %d) \n",status)); @@ -521,10 +521,10 @@ A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfig) return status; } -A_STATUS AR3KConfigureExit(void *config) +int AR3KConfigureExit(void *config) { - A_STATUS status = A_OK; - AR3K_CONFIG_INFO *pConfig = (AR3K_CONFIG_INFO *)config; + int status = 0; + struct ar3k_config_info *pConfig = (struct ar3k_config_info *)config; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Cleaning up AR3K ...\n")); @@ -536,27 +536,27 @@ A_STATUS AR3KConfigureExit(void *config) } /* disable asynchronous recv while we issue commands and receive events synchronously */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,FALSE); - if (A_FAILED(status)) { + status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,false); + if (status) { break; } if (pConfig->Flags & (AR3K_CONFIG_FLAG_SET_AR3K_BAUD | AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP)) { status = AR3KConfigureHCIBaud(pConfig); - if (A_FAILED(status)) { + if (status) { break; } } /* re-enable asynchronous recv */ - status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,TRUE); - if (A_FAILED(status)) { + status = HCI_TransportEnableDisableAsyncRecv(pConfig->pHCIDev,true); + if (status) { break; } - } while (FALSE); + } while (false); AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR3K Config: Cleanup Complete (status = %d) \n",status)); diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c index 29b8ab4..8393efe 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.c @@ -41,41 +41,41 @@ */ typedef struct { - PSCmdPacket *HciCmdList; - A_UINT32 num_packets; - AR3K_CONFIG_INFO *dev; + struct ps_cmd_packet *HciCmdList; + u32 num_packets; + struct ar3k_config_info *dev; }HciCommandListParam; -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, +int SendHCICommandWaitCommandComplete(struct ar3k_config_info *pConfig, + u8 *pHCICommand, int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree); + u8 **ppEventBuffer, + u8 **ppBufferToFree); -A_UINT32 Rom_Version; -A_UINT32 Build_Version; -extern A_BOOL BDADDR; +u32 Rom_Version; +u32 Build_Version; +extern bool BDADDR; -A_STATUS getDeviceType(AR3K_CONFIG_INFO *pConfig, A_UINT32 * code); -A_STATUS ReadVersionInfo(AR3K_CONFIG_INFO *pConfig); +int getDeviceType(struct ar3k_config_info *pConfig, u32 *code); +int ReadVersionInfo(struct ar3k_config_info *pConfig); #ifndef HCI_TRANSPORT_SDIO DECLARE_WAIT_QUEUE_HEAD(PsCompleteEvent); DECLARE_WAIT_QUEUE_HEAD(HciEvent); -A_UCHAR *HciEventpacket; +u8 *HciEventpacket; rwlock_t syncLock; wait_queue_t Eventwait; -int PSHciWritepacket(struct hci_dev*,A_UCHAR* Data, A_UINT32 len); +int PSHciWritepacket(struct hci_dev*,u8* Data, u32 len); extern char *bdaddr; #endif /* HCI_TRANSPORT_SDIO */ -A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type); +int write_bdaddr(struct ar3k_config_info *pConfig,u8 *bdaddr,int type); int PSSendOps(void *arg); #ifdef BT_PS_DEBUG -void Hci_log(A_UCHAR * log_string,A_UCHAR *data,A_UINT32 len) +void Hci_log(u8 * log_string,u8 *data,u32 len) { int i; AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("%s : ",log_string)); @@ -91,9 +91,9 @@ void Hci_log(A_UCHAR * log_string,A_UCHAR *data,A_UINT32 len) -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev) +int AthPSInitialize(struct ar3k_config_info *hdev) { - A_STATUS status = A_OK; + int status = 0; if(hdev == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Device handle received\n")); return A_ERROR; @@ -118,7 +118,7 @@ A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev) remove_wait_queue(&PsCompleteEvent,&wait); return A_ERROR; } - wait_event_interruptible(PsCompleteEvent,(PSTagMode == FALSE)); + wait_event_interruptible(PsCompleteEvent,(PSTagMode == false)); set_current_state(TASK_RUNNING); remove_wait_queue(&PsCompleteEvent,&wait); @@ -133,21 +133,21 @@ int PSSendOps(void *arg) { int i; int status = 0; - PSCmdPacket *HciCmdList; /* List storing the commands */ + struct ps_cmd_packet *HciCmdList; /* List storing the commands */ const struct firmware* firmware; - A_UINT32 numCmds; - A_UINT8 *event; - A_UINT8 *bufferToFree; + u32 numCmds; + u8 *event; + u8 *bufferToFree; struct hci_dev *device; - A_UCHAR *buffer; - A_UINT32 len; - A_UINT32 DevType; - A_UCHAR *PsFileName; - A_UCHAR *patchFileName; - A_UCHAR *path = NULL; - A_UCHAR *config_path = NULL; - A_UCHAR config_bdaddr[MAX_BDADDR_FORMAT_LENGTH]; - AR3K_CONFIG_INFO *hdev = (AR3K_CONFIG_INFO*)arg; + u8 *buffer; + u32 len; + u32 DevType; + u8 *PsFileName; + u8 *patchFileName; + u8 *path = NULL; + u8 *config_path = NULL; + u8 config_bdaddr[MAX_BDADDR_FORMAT_LENGTH]; + struct ar3k_config_info *hdev = (struct ar3k_config_info*)arg; struct device *firmwareDev = NULL; status = 0; HciCmdList = NULL; @@ -157,17 +157,17 @@ int PSSendOps(void *arg) #else device = hdev; firmwareDev = &device->dev; - AthEnableSyncCommandOp(TRUE); + AthEnableSyncCommandOp(true); #endif /* HCI_TRANSPORT_SDIO */ /* First verify if the controller is an FPGA or ASIC, so depending on the device type the PS file to be written will be different. */ - path =(A_UCHAR *)A_MALLOC(MAX_FW_PATH_LEN); + path =(u8 *)A_MALLOC(MAX_FW_PATH_LEN); if(path == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Malloc failed to allocate %d bytes for path\n", MAX_FW_PATH_LEN)); goto complete; } - config_path = (A_UCHAR *) A_MALLOC(MAX_FW_PATH_LEN); + config_path = (u8 *) A_MALLOC(MAX_FW_PATH_LEN); if(config_path == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Malloc failed to allocate %d bytes for config_path\n", MAX_FW_PATH_LEN)); goto complete; @@ -214,7 +214,7 @@ int PSSendOps(void *arg) status = 1; goto complete; } - buffer = (A_UCHAR *)A_MALLOC(firmware->size); + buffer = (u8 *)A_MALLOC(firmware->size); if(buffer != NULL) { /* Copy the read file to a local Dynamic buffer */ memcpy(buffer,firmware->data,firmware->size); @@ -248,7 +248,7 @@ int PSSendOps(void *arg) if(NULL == firmware || firmware->size == 0) { status = 0; } else { - buffer = (A_UCHAR *)A_MALLOC(firmware->size); + buffer = (u8 *)A_MALLOC(firmware->size); if(buffer != NULL) { /* Copy the read file to a local Dynamic buffer */ memcpy(buffer,firmware->data,firmware->size); @@ -280,8 +280,8 @@ int PSSendOps(void *arg) HciCmdList[0].Hcipacket, HciCmdList[0].packetLen, &event, - &bufferToFree) == A_OK) { - if(ReadPSEvent(event) == A_OK) { /* Exit if the status is success */ + &bufferToFree) == 0) { + if(ReadPSEvent(event) == 0) { /* Exit if the status is success */ if(bufferToFree != NULL) { A_FREE(bufferToFree); } @@ -309,8 +309,8 @@ int PSSendOps(void *arg) HciCmdList[i].Hcipacket, HciCmdList[i].packetLen, &event, - &bufferToFree) == A_OK) { - if(ReadPSEvent(event) != A_OK) { /* Exit if the status is success */ + &bufferToFree) == 0) { + if(ReadPSEvent(event) != 0) { /* Exit if the status is success */ if(bufferToFree != NULL) { A_FREE(bufferToFree); } @@ -326,7 +326,7 @@ int PSSendOps(void *arg) } } #ifdef HCI_TRANSPORT_SDIO - if(BDADDR == FALSE) + if(BDADDR == false) if(hdev->bdaddr[0] !=0x00 || hdev->bdaddr[1] !=0x00 || hdev->bdaddr[2] !=0x00 || @@ -360,7 +360,7 @@ int PSSendOps(void *arg) status = 1; goto complete; } - len = min(firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1); + len = min_t(size_t, firmware->size, MAX_BDADDR_FORMAT_LENGTH - 1); memcpy(config_bdaddr, firmware->data, len); config_bdaddr[len] = '\0'; write_bdaddr(hdev,config_bdaddr,BDADDR_TYPE_STRING); @@ -368,8 +368,8 @@ int PSSendOps(void *arg) } complete: #ifndef HCI_TRANSPORT_SDIO - AthEnableSyncCommandOp(FALSE); - PSTagMode = FALSE; + AthEnableSyncCommandOp(false); + PSTagMode = false; wake_up_interruptible(&PsCompleteEvent); #endif /* HCI_TRANSPORT_SDIO */ if(NULL != HciCmdList) { @@ -389,23 +389,23 @@ complete: * with a HCI Command Complete event. * For HCI SDIO transport, this will be internally defined. */ -A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, - A_UINT8 *pHCICommand, +int SendHCICommandWaitCommandComplete(struct ar3k_config_info *pConfig, + u8 *pHCICommand, int CmdLength, - A_UINT8 **ppEventBuffer, - A_UINT8 **ppBufferToFree) + u8 **ppEventBuffer, + u8 **ppBufferToFree) { if(CmdLength == 0) { return A_ERROR; } Hci_log("COM Write -->",pHCICommand,CmdLength); - PSAcked = FALSE; + PSAcked = false; if(PSHciWritepacket(pConfig,pHCICommand,CmdLength) == 0) { /* If the controller is not available, return Error */ return A_ERROR; } //add_timer(&psCmdTimer); - wait_event_interruptible(HciEvent,(PSAcked == TRUE)); + wait_event_interruptible(HciEvent,(PSAcked == true)); if(NULL != HciEventpacket) { *ppEventBuffer = HciEventpacket; *ppBufferToFree = HciEventpacket; @@ -415,25 +415,25 @@ A_STATUS SendHCICommandWaitCommandComplete(AR3K_CONFIG_INFO *pConfig, return A_ERROR; } - return A_OK; + return 0; } #endif /* HCI_TRANSPORT_SDIO */ -A_STATUS ReadPSEvent(A_UCHAR* Data){ +int ReadPSEvent(u8* Data){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" PS Event %x %x %x\n",Data[4],Data[5],Data[3])); if(Data[4] == 0xFC && Data[5] == 0x00) { switch(Data[3]){ case 0x0B: - return A_OK; + return 0; break; case 0x0C: /* Change Baudrate */ - return A_OK; + return 0; break; case 0x04: - return A_OK; + return 0; break; case 0x1E: Rom_Version = Data[9]; @@ -445,7 +445,7 @@ A_STATUS ReadPSEvent(A_UCHAR* Data){ Build_Version = ((Build_Version << 8) |Data[12]); Build_Version = ((Build_Version << 8) |Data[11]); Build_Version = ((Build_Version << 8) |Data[10]); - return A_OK; + return 0; break; @@ -481,14 +481,14 @@ int str2ba(unsigned char *str_bdaddr,unsigned char *bdaddr) return 0; } -A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type) +int write_bdaddr(struct ar3k_config_info *pConfig,u8 *bdaddr,int type) { - A_UCHAR bdaddr_cmd[] = { 0x0B, 0xFC, 0x0A, 0x01, 0x01, + u8 bdaddr_cmd[] = { 0x0B, 0xFC, 0x0A, 0x01, 0x01, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_STATUS result = A_ERROR; + u8 *event; + u8 *bufferToFree = NULL; + int result = A_ERROR; int inc,outc; if (type == BDADDR_TYPE_STRING) @@ -499,13 +499,13 @@ A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type) bdaddr_cmd[outc] = bdaddr[inc]; } - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,bdaddr_cmd, + if(0 == SendHCICommandWaitCommandComplete(pConfig,bdaddr_cmd, sizeof(bdaddr_cmd), &event,&bufferToFree)) { if(event[4] == 0xFC && event[5] == 0x00){ if(event[3] == 0x0B){ - result = A_OK; + result = 0; } } @@ -516,13 +516,13 @@ A_STATUS write_bdaddr(AR3K_CONFIG_INFO *pConfig,A_UCHAR *bdaddr,int type) return result; } -A_STATUS ReadVersionInfo(AR3K_CONFIG_INFO *pConfig) +int ReadVersionInfo(struct ar3k_config_info *pConfig) { - A_UINT8 hciCommand[] = {0x1E,0xfc,0x00}; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_STATUS result = A_ERROR; - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { + u8 hciCommand[] = {0x1E,0xfc,0x00}; + u8 *event; + u8 *bufferToFree = NULL; + int result = A_ERROR; + if(0 == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { result = ReadPSEvent(event); } @@ -531,19 +531,19 @@ A_STATUS ReadVersionInfo(AR3K_CONFIG_INFO *pConfig) } return result; } -A_STATUS getDeviceType(AR3K_CONFIG_INFO *pConfig, A_UINT32 * code) +int getDeviceType(struct ar3k_config_info *pConfig, u32 *code) { - A_UINT8 hciCommand[] = {0x05,0xfc,0x05,0x00,0x00,0x00,0x00,0x04}; - A_UINT8 *event; - A_UINT8 *bufferToFree = NULL; - A_UINT32 reg; - A_STATUS result = A_ERROR; + u8 hciCommand[] = {0x05,0xfc,0x05,0x00,0x00,0x00,0x00,0x04}; + u8 *event; + u8 *bufferToFree = NULL; + u32 reg; + int result = A_ERROR; *code = 0; - hciCommand[3] = (A_UINT8)(FPGA_REGISTER & 0xFF); - hciCommand[4] = (A_UINT8)((FPGA_REGISTER >> 8) & 0xFF); - hciCommand[5] = (A_UINT8)((FPGA_REGISTER >> 16) & 0xFF); - hciCommand[6] = (A_UINT8)((FPGA_REGISTER >> 24) & 0xFF); - if(A_OK == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { + hciCommand[3] = (u8)(FPGA_REGISTER & 0xFF); + hciCommand[4] = (u8)((FPGA_REGISTER >> 8) & 0xFF); + hciCommand[5] = (u8)((FPGA_REGISTER >> 16) & 0xFF); + hciCommand[6] = (u8)((FPGA_REGISTER >> 24) & 0xFF); + if(0 == SendHCICommandWaitCommandComplete(pConfig,hciCommand,sizeof(hciCommand),&event,&bufferToFree)) { if(event[4] == 0xFC && event[5] == 0x00){ switch(event[3]){ @@ -553,7 +553,7 @@ A_STATUS getDeviceType(AR3K_CONFIG_INFO *pConfig, A_UINT32 * code) reg = ((reg << 8) |event[7]); reg = ((reg << 8) |event[6]); *code = reg; - result = A_OK; + result = 0; break; case 0x06: diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h index 4e5b7bf..d443513 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsconfig.h @@ -64,12 +64,12 @@ #ifndef HCI_TRANSPORT_SDIO -#define AR3K_CONFIG_INFO struct hci_dev +#define struct ar3k_config_info struct hci_dev extern wait_queue_head_t HciEvent; extern wait_queue_t Eventwait; -extern A_UCHAR *HciEventpacket; +extern u8 *HciEventpacket; #endif /* #ifndef HCI_TRANSPORT_SDIO */ -A_STATUS AthPSInitialize(AR3K_CONFIG_INFO *hdev); -A_STATUS ReadPSEvent(A_UCHAR* Data); +int AthPSInitialize(struct ar3k_config_info *hdev); +int ReadPSEvent(u8* Data); #endif /* __AR3KPSCONFIG_H */ diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c index 8dce054..94a0939 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.c @@ -87,53 +87,53 @@ enum eType { typedef struct tPsTagEntry { - A_UINT32 TagId; - A_UINT32 TagLen; - A_UINT8 *TagData; + u32 TagId; + u32 TagLen; + u8 *TagData; } tPsTagEntry, *tpPsTagEntry; typedef struct tRamPatch { - A_UINT16 Len; - A_UINT8 * Data; + u16 Len; + u8 *Data; } tRamPatch, *ptRamPatch; -typedef struct ST_PS_DATA_FORMAT { +struct st_ps_data_format { enum eType eDataType; - A_BOOL bIsArray; -}ST_PS_DATA_FORMAT; + bool bIsArray; +}; -typedef struct ST_READ_STATUS { +struct st_read_status { unsigned uTagID; unsigned uSection; unsigned uLineCount; unsigned uCharCount; unsigned uByteCount; -}ST_READ_STATUS; +}; /* Stores the number of PS Tags */ -static A_UINT32 Tag_Count = 0; +static u32 Tag_Count = 0; /* Stores the number of patch commands */ -static A_UINT32 Patch_Count = 0; -static A_UINT32 Total_tag_lenght = 0; -A_BOOL BDADDR = FALSE; -A_UINT32 StartTagId; +static u32 Patch_Count = 0; +static u32 Total_tag_lenght = 0; +bool BDADDR = false; +u32 StartTagId; tPsTagEntry PsTagEntry[RAMPS_MAX_PS_TAGS_PER_FILE]; tRamPatch RamPatch[MAX_NUM_PATCH_ENTRY]; -A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat); -char AthReadChar(A_UCHAR *buffer, A_UINT32 len,A_UINT32 *pos); -char * AthGetLine(char * buffer, int maxlen, A_UCHAR *srcbuffer,A_UINT32 len,A_UINT32 *pos); -static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacket *PSPatchPacket,A_UINT32 *index); +int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat); +char AthReadChar(u8 *buffer, u32 len,u32 *pos); +char *AthGetLine(char *buffer, int maxlen, u8 *srcbuffer,u32 len,u32 *pos); +static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,struct ps_cmd_packet *PSPatchPacket,u32 *index); /* Function to reads the next character from the input buffer */ -char AthReadChar(A_UCHAR *buffer, A_UINT32 len,A_UINT32 *pos) +char AthReadChar(u8 *buffer, u32 len,u32 *pos) { char Ch; if(buffer == NULL || *pos >=len ) @@ -146,7 +146,7 @@ char AthReadChar(A_UCHAR *buffer, A_UINT32 len,A_UINT32 *pos) } } /* PS parser helper function */ -unsigned int uGetInputDataFormat(char* pCharLine, ST_PS_DATA_FORMAT *pstFormat) +unsigned int uGetInputDataFormat(char *pCharLine, struct st_ps_data_format *pstFormat) { if(pCharLine[0] != '[') { pstFormat->eDataType = eHex; @@ -286,7 +286,7 @@ unsigned int uGetInputDataFormat(char* pCharLine, ST_PS_DATA_FORMAT *pstFormat) } } -unsigned int uReadDataInSection(char *pCharLine, ST_PS_DATA_FORMAT stPS_DataFormat) +unsigned int uReadDataInSection(char *pCharLine, struct st_ps_data_format stPS_DataFormat) { char *pTokenPtr = pCharLine; @@ -315,20 +315,20 @@ unsigned int uReadDataInSection(char *pCharLine, ST_PS_DATA_FORMAT stPS_DataForm return (0x0FFF); } } -A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat) +int AthParseFilesUnified(u8 *srcbuffer,u32 srclen, int FileFormat) { - char *Buffer; - char *pCharLine; - A_UINT8 TagCount; - A_UINT16 ByteCount; - A_UINT8 ParseSection=RAM_PS_SECTION; - A_UINT32 pos; + char *Buffer; + char *pCharLine; + u8 TagCount; + u16 ByteCount; + u8 ParseSection=RAM_PS_SECTION; + u32 pos; int uReadCount; - ST_PS_DATA_FORMAT stPS_DataFormat; - ST_READ_STATUS stReadStatus = {0, 0, 0,0}; + struct st_ps_data_format stPS_DataFormat; + struct st_read_status stReadStatus = {0, 0, 0,0}; pos = 0; Buffer = NULL; @@ -438,7 +438,7 @@ A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat return A_ERROR; } PsTagEntry[TagCount].TagLen = ByteCount; - PsTagEntry[TagCount].TagData = (A_UINT8*)A_MALLOC(ByteCount); + PsTagEntry[TagCount].TagData = (u8 *)A_MALLOC(ByteCount); AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" TAG Length %d Tag Index %d \n",PsTagEntry[TagCount].TagLen,TagCount)); stReadStatus.uSection = 3; stReadStatus.uLineCount = 0; @@ -472,12 +472,12 @@ A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat if((stPS_DataFormat.eDataType == eHex) && stPS_DataFormat.bIsArray == true) { while(uReadCount > 0) { PsTagEntry[TagCount].TagData[stReadStatus.uByteCount] = - (A_UINT8)(hex_to_bin(pCharLine[stReadStatus.uCharCount]) << 4) - | (A_UINT8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 1])); + (u8)(hex_to_bin(pCharLine[stReadStatus.uCharCount]) << 4) + | (u8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 1])); PsTagEntry[TagCount].TagData[stReadStatus.uByteCount+1] = - (A_UINT8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 3]) << 4) - | (A_UINT8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 4])); + (u8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 3]) << 4) + | (u8)(hex_to_bin(pCharLine[stReadStatus.uCharCount + 4])); stReadStatus.uCharCount += 6; // read two bytes, plus a space; stReadStatus.uByteCount += 2; @@ -549,7 +549,7 @@ A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat if(Buffer != NULL) { A_FREE(Buffer); } - return A_OK; + return 0; } @@ -558,7 +558,7 @@ A_STATUS AthParseFilesUnified(A_UCHAR *srcbuffer,A_UINT32 srclen, int FileFormat /********************/ -A_STATUS GetNextTwoChar(A_UCHAR *srcbuffer,A_UINT32 len, A_UINT32 *pos, char * buffer) +int GetNextTwoChar(u8 *srcbuffer,u32 len, u32 *pos, char *buffer) { unsigned char ch; @@ -576,19 +576,19 @@ A_STATUS GetNextTwoChar(A_UCHAR *srcbuffer,A_UINT32 len, A_UINT32 *pos, char * b { return A_ERROR; } - return A_OK; + return 0; } -A_STATUS AthDoParsePatch(A_UCHAR *patchbuffer, A_UINT32 patchlen) +int AthDoParsePatch(u8 *patchbuffer, u32 patchlen) { - char Byte[3]; - char Line[MAX_BYTE_LENGTH + 1]; + char Byte[3]; + char Line[MAX_BYTE_LENGTH + 1]; int ByteCount,ByteCount_Org; int count; int i,j,k; int data; - A_UINT32 filepos; + u32 filepos; Byte[2] = '\0'; j = 0; filepos = 0; @@ -614,7 +614,7 @@ A_STATUS AthDoParsePatch(A_UCHAR *patchbuffer, A_UINT32 patchlen) return A_ERROR; } RamPatch[Patch_Count].Len= MAX_BYTE_LENGTH; - RamPatch[Patch_Count].Data = (A_UINT8*)A_MALLOC(MAX_BYTE_LENGTH); + RamPatch[Patch_Count].Data = (u8 *)A_MALLOC(MAX_BYTE_LENGTH); Patch_Count ++; @@ -623,7 +623,7 @@ A_STATUS AthDoParsePatch(A_UCHAR *patchbuffer, A_UINT32 patchlen) RamPatch[Patch_Count].Len= (ByteCount & 0xFF); if(ByteCount != 0) { - RamPatch[Patch_Count].Data = (A_UINT8*)A_MALLOC(ByteCount); + RamPatch[Patch_Count].Data = (u8 *)A_MALLOC(ByteCount); Patch_Count ++; } count = 0; @@ -654,21 +654,21 @@ A_STATUS AthDoParsePatch(A_UCHAR *patchbuffer, A_UINT32 patchlen) } - return A_OK; + return 0; } /********************/ -A_STATUS AthDoParsePS(A_UCHAR *srcbuffer, A_UINT32 srclen) +int AthDoParsePS(u8 *srcbuffer, u32 srclen) { - A_STATUS status; + int status; int i; - A_BOOL BDADDR_Present = A_ERROR; + bool BDADDR_Present = false; Tag_Count = 0; Total_tag_lenght = 0; - BDADDR = FALSE; + BDADDR = false; status = A_ERROR; @@ -689,7 +689,7 @@ A_STATUS AthDoParsePS(A_UCHAR *srcbuffer, A_UINT32 srclen) else{ for(i=0; i<Tag_Count; i++){ if(PsTagEntry[i].TagId == 1){ - BDADDR_Present = A_OK; + BDADDR_Present = true; AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BD ADDR is present in Patch File \r\n")); } @@ -713,7 +713,7 @@ A_STATUS AthDoParsePS(A_UCHAR *srcbuffer, A_UINT32 srclen) return status; } -char * AthGetLine(char * buffer, int maxlen, A_UCHAR *srcbuffer,A_UINT32 len,A_UINT32 *pos) +char *AthGetLine(char *buffer, int maxlen, u8 *srcbuffer,u32 len,u32 *pos) { int count; @@ -751,7 +751,7 @@ char * AthGetLine(char * buffer, int maxlen, A_UCHAR *srcbuffer,A_UINT32 len,A_U return buffer; } -static void LoadHeader(A_UCHAR *HCI_PS_Command,A_UCHAR opcode,int length,int index){ +static void LoadHeader(u8 *HCI_PS_Command,u8 opcode,int length,int index){ HCI_PS_Command[0]= 0x0B; HCI_PS_Command[1]= 0xFC; @@ -764,13 +764,13 @@ static void LoadHeader(A_UCHAR *HCI_PS_Command,A_UCHAR opcode,int length,int ind ///////////////////////// // -int AthCreateCommandList(PSCmdPacket **HciPacketList, A_UINT32 *numPackets) +int AthCreateCommandList(struct ps_cmd_packet **HciPacketList, u32 *numPackets) { - A_UINT8 count; - A_UINT32 NumcmdEntry = 0; + u8 count; + u32 NumcmdEntry = 0; - A_UINT32 Crc = 0; + u32 Crc = 0; *numPackets = 0; @@ -785,8 +785,8 @@ int AthCreateCommandList(PSCmdPacket **HciPacketList, A_UINT32 *numPackets) if(Patch_Count > 0) { NumcmdEntry++; /* Patch Enable Command */ } - AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Num Cmd Entries %d Size %d \r\n",NumcmdEntry,(A_UINT32)sizeof(PSCmdPacket) * NumcmdEntry)); - (*HciPacketList) = A_MALLOC(sizeof(PSCmdPacket) * NumcmdEntry); + AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Num Cmd Entries %d Size %d \r\n",NumcmdEntry,(u32)sizeof(struct ps_cmd_packet) * NumcmdEntry)); + (*HciPacketList) = A_MALLOC(sizeof(struct ps_cmd_packet) * NumcmdEntry); if(NULL == *HciPacketList) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("memory allocation failed \r\n")); } @@ -833,10 +833,10 @@ int AthCreateCommandList(PSCmdPacket **HciPacketList, A_UINT32 *numPackets) //////////////////////// ///////////// -static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacket *PSPatchPacket,A_UINT32 *index) +static int AthPSCreateHCICommand(u8 Opcode, u32 Param1,struct ps_cmd_packet *PSPatchPacket,u32 *index) { - A_UCHAR *HCI_PS_Command; - A_UINT32 Length; + u8 *HCI_PS_Command; + u32 Length; int i,j; switch(Opcode) @@ -846,7 +846,7 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke for(i=0;i< Param1;i++){ - HCI_PS_Command = (A_UCHAR *) A_MALLOC(RamPatch[i].Len+HCI_COMMAND_HEADER); + HCI_PS_Command = (u8 *) A_MALLOC(RamPatch[i].Len+HCI_COMMAND_HEADER); AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Allocated Buffer Size %d\n",RamPatch[i].Len+HCI_COMMAND_HEADER)); if(HCI_PS_Command == NULL){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); @@ -871,7 +871,7 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke Length = 0; i= 0; - HCI_PS_Command = (A_UCHAR *) A_MALLOC(Length+HCI_COMMAND_HEADER); + HCI_PS_Command = (u8 *) A_MALLOC(Length+HCI_COMMAND_HEADER); if(HCI_PS_Command == NULL){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); return A_ERROR; @@ -888,7 +888,7 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke case PS_RESET: Length = 0x06; i=0; - HCI_PS_Command = (A_UCHAR *) A_MALLOC(Length+HCI_COMMAND_HEADER); + HCI_PS_Command = (u8 *) A_MALLOC(Length+HCI_COMMAND_HEADER); if(HCI_PS_Command == NULL){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); return A_ERROR; @@ -907,9 +907,9 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke case PS_WRITE: for(i=0;i< Param1;i++){ if(PsTagEntry[i].TagId ==1) - BDADDR = TRUE; + BDADDR = true; - HCI_PS_Command = (A_UCHAR *) A_MALLOC(PsTagEntry[i].TagLen+HCI_COMMAND_HEADER); + HCI_PS_Command = (u8 *) A_MALLOC(PsTagEntry[i].TagLen+HCI_COMMAND_HEADER); if(HCI_PS_Command == NULL){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); return A_ERROR; @@ -936,7 +936,7 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("VALUE of CRC:%d At index %d\r\n",Param1,*index)); - HCI_PS_Command = (A_UCHAR *) A_MALLOC(Length+HCI_COMMAND_HEADER); + HCI_PS_Command = (u8 *) A_MALLOC(Length+HCI_COMMAND_HEADER); if(HCI_PS_Command == NULL){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("MALLOC Failed\r\n")); return A_ERROR; @@ -953,9 +953,9 @@ static A_STATUS AthPSCreateHCICommand(A_UCHAR Opcode, A_UINT32 Param1,PSCmdPacke case CHANGE_BDADDR: break; } - return A_OK; + return 0; } -A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets) +int AthFreeCommandList(struct ps_cmd_packet **HciPacketList, u32 numPackets) { int i; if(*HciPacketList == NULL) { @@ -965,5 +965,5 @@ A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets) A_FREE((*HciPacketList)[i].Hcipacket); } A_FREE(*HciPacketList); - return A_OK; + return 0; } diff --git a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h index 007b0eb..9378efc 100644 --- a/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h +++ b/drivers/staging/ath6kl/miscdrv/ar3kps/ar3kpsparser.h @@ -48,22 +48,14 @@ /* Helper data type declaration */ -#ifndef A_UINT32 -#define A_UCHAR unsigned char -#define A_UINT32 unsigned long -#define A_UINT16 unsigned short -#define A_UINT8 unsigned char -#define A_BOOL unsigned char -#endif /* A_UINT32 */ - #define ATH_DEBUG_ERR (1 << 0) #define ATH_DEBUG_WARN (1 << 1) #define ATH_DEBUG_INFO (1 << 2) -#define FALSE 0 -#define TRUE 1 +#define false 0 +#define true 1 #ifndef A_MALLOC #define A_MALLOC(size) kmalloc((size),GFP_KERNEL) @@ -97,17 +89,17 @@ -typedef struct PSCmdPacket +struct ps_cmd_packet { - A_UCHAR *Hcipacket; + u8 *Hcipacket; int packetLen; -} PSCmdPacket; +}; /* Parses a Patch information buffer and store it in global structure */ -A_STATUS AthDoParsePatch(A_UCHAR *, A_UINT32); +int AthDoParsePatch(u8 *, u32 ); /* parses a PS information buffer and stores it in a global structure */ -A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32); +int AthDoParsePS(u8 *, u32 ); /* * Uses the output of Both AthDoParsePS and AthDoParsePatch APIs to form HCI command array with @@ -120,8 +112,8 @@ A_STATUS AthDoParsePS(A_UCHAR *, A_UINT32); * PS Tag Command(s) * */ -int AthCreateCommandList(PSCmdPacket **, A_UINT32 *); +int AthCreateCommandList(struct ps_cmd_packet **, u32 *); /* Cleanup the dynamically allicated HCI command list */ -A_STATUS AthFreeCommandList(PSCmdPacket **HciPacketList, A_UINT32 numPackets); +int AthFreeCommandList(struct ps_cmd_packet **HciPacketList, u32 numPackets); #endif /* __AR3KPSPARSER_H */ diff --git a/drivers/staging/ath6kl/miscdrv/common_drv.c b/drivers/staging/ath6kl/miscdrv/common_drv.c index 6754fde..a23a524 100644 --- a/drivers/staging/ath6kl/miscdrv/common_drv.c +++ b/drivers/staging/ath6kl/miscdrv/common_drv.c @@ -47,7 +47,7 @@ static ATH_DEBUG_MODULE_DBG_INFO *g_pModuleInfoHead = NULL; static A_MUTEX_T g_ModuleListLock; -static A_BOOL g_ModuleDebugInit = FALSE; +static bool g_ModuleDebugInit = false; #ifdef ATH_DEBUG_MODULE @@ -71,8 +71,8 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(misc, #define CPU_DBG_SEL_ADDRESS 0x00000483 #define CPU_DBG_ADDRESS 0x00000484 -static A_UINT8 custDataAR6002[AR6002_CUST_DATA_SIZE]; -static A_UINT8 custDataAR6003[AR6003_CUST_DATA_SIZE]; +static u8 custDataAR6002[AR6002_CUST_DATA_SIZE]; +static u8 custDataAR6003[AR6003_CUST_DATA_SIZE]; /* Compile the 4BYTE version of the window register setup routine, * This mitigates host interconnect issues with non-4byte aligned bus requests, some @@ -83,18 +83,18 @@ static A_UINT8 custDataAR6003[AR6003_CUST_DATA_SIZE]; #ifdef USE_4BYTE_REGISTER_ACCESS /* set the window address register (using 4-byte register access ). */ -A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 RegisterAddr, A_UINT32 Address) +int ar6000_SetAddressWindowRegister(struct hif_device *hifDevice, u32 RegisterAddr, u32 Address) { - A_STATUS status; - A_UINT8 addrValue[4]; - A_INT32 i; + int status; + u8 addrValue[4]; + s32 i; /* write bytes 1,2,3 of the register to set the upper address bytes, the LSB is written * last to initiate the access cycle */ for (i = 1; i <= 3; i++) { /* fill the buffer with the address byte value we want to hit 4 times*/ - addrValue[0] = ((A_UINT8 *)&Address)[i]; + addrValue[0] = ((u8 *)&Address)[i]; addrValue[1] = addrValue[0]; addrValue[2] = addrValue[0]; addrValue[3] = addrValue[0]; @@ -107,12 +107,12 @@ A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 Registe 4, HIF_WR_SYNC_BYTE_FIX, NULL); - if (status != A_OK) { + if (status) { break; } } - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write initial bytes of 0x%x to window reg: 0x%X \n", Address, RegisterAddr)); return status; @@ -123,18 +123,18 @@ A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 Registe * 3 byte write to bytes 1,2,3 has no effect since we are writing the same values again */ status = HIFReadWrite(hifDevice, RegisterAddr, - (A_UCHAR *)(&Address), + (u8 *)(&Address), 4, HIF_WR_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to window reg: 0x%X \n", Address, RegisterAddr)); return status; } - return A_OK; + return 0; @@ -144,20 +144,20 @@ A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 Registe #else /* set the window address register */ -A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 RegisterAddr, A_UINT32 Address) +int ar6000_SetAddressWindowRegister(struct hif_device *hifDevice, u32 RegisterAddr, u32 Address) { - A_STATUS status; + int status; /* write bytes 1,2,3 of the register to set the upper address bytes, the LSB is written * last to initiate the access cycle */ status = HIFReadWrite(hifDevice, RegisterAddr+1, /* write upper 3 bytes */ - ((A_UCHAR *)(&Address))+1, - sizeof(A_UINT32)-1, + ((u8 *)(&Address))+1, + sizeof(u32)-1, HIF_WR_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write initial bytes of 0x%x to window reg: 0x%X \n", RegisterAddr, Address)); return status; @@ -166,18 +166,18 @@ A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 Registe /* write the LSB of the register, this initiates the operation */ status = HIFReadWrite(hifDevice, RegisterAddr, - (A_UCHAR *)(&Address), - sizeof(A_UINT8), + (u8 *)(&Address), + sizeof(u8), HIF_WR_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to window reg: 0x%X \n", RegisterAddr, Address)); return status; } - return A_OK; + return 0; } #endif @@ -186,28 +186,28 @@ A_STATUS ar6000_SetAddressWindowRegister(HIF_DEVICE *hifDevice, A_UINT32 Registe * Read from the AR6000 through its diagnostic window. * No cooperation from the Target is required for this. */ -A_STATUS -ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) +int +ar6000_ReadRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data) { - A_STATUS status; + int status; /* set window register to start read cycle */ status = ar6000_SetAddressWindowRegister(hifDevice, WINDOW_READ_ADDR_ADDRESS, *address); - if (status != A_OK) { + if (status) { return status; } /* read the data */ status = HIFReadWrite(hifDevice, WINDOW_DATA_ADDRESS, - (A_UCHAR *)data, - sizeof(A_UINT32), + (u8 *)data, + sizeof(u32), HIF_RD_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot read from WINDOW_DATA_ADDRESS\n")); return status; } @@ -220,19 +220,19 @@ ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) * Write to the AR6000 through its diagnostic window. * No cooperation from the Target is required for this. */ -A_STATUS -ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) +int +ar6000_WriteRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data) { - A_STATUS status; + int status; /* set write data */ status = HIFReadWrite(hifDevice, WINDOW_DATA_ADDRESS, - (A_UCHAR *)data, - sizeof(A_UINT32), + (u8 *)data, + sizeof(u32), HIF_WR_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write 0x%x to WINDOW_DATA_ADDRESS\n", *data)); return status; } @@ -243,16 +243,16 @@ ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data) *address); } -A_STATUS -ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length) +int +ar6000_ReadDataDiag(struct hif_device *hifDevice, u32 address, + u8 *data, u32 length) { - A_UINT32 count; - A_STATUS status = A_OK; + u32 count; + int status = 0; for (count = 0; count < length; count += 4, address += 4) { if ((status = ar6000_ReadRegDiag(hifDevice, &address, - (A_UINT32 *)&data[count])) != A_OK) + (u32 *)&data[count])) != 0) { break; } @@ -261,16 +261,16 @@ ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, return status; } -A_STATUS -ar6000_WriteDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, - A_UCHAR *data, A_UINT32 length) +int +ar6000_WriteDataDiag(struct hif_device *hifDevice, u32 address, + u8 *data, u32 length) { - A_UINT32 count; - A_STATUS status = A_OK; + u32 count; + int status = 0; for (count = 0; count < length; count += 4, address += 4) { if ((status = ar6000_WriteRegDiag(hifDevice, &address, - (A_UINT32 *)&data[count])) != A_OK) + (u32 *)&data[count])) != 0) { break; } @@ -279,12 +279,12 @@ ar6000_WriteDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address, return status; } -A_STATUS -ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval) +int +ar6k_ReadTargetRegister(struct hif_device *hifDevice, int regsel, u32 *regval) { - A_STATUS status; - A_UCHAR vals[4]; - A_UCHAR register_selection[4]; + int status; + u8 vals[4]; + u8 register_selection[4]; register_selection[0] = register_selection[1] = register_selection[2] = register_selection[3] = (regsel & 0xff); status = HIFReadWrite(hifDevice, @@ -294,18 +294,18 @@ ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval) HIF_WR_SYNC_BYTE_FIX, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot write CPU_DBG_SEL (%d)\n", regsel)); return status; } status = HIFReadWrite(hifDevice, CPU_DBG_ADDRESS, - (A_UCHAR *)vals, + (u8 *)vals, sizeof(vals), HIF_RD_SYNC_BYTE_INC, NULL); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot read from CPU_DBG_ADDRESS\n")); return status; } @@ -316,10 +316,10 @@ ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval) } void -ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs) +ar6k_FetchTargetRegs(struct hif_device *hifDevice, u32 *targregs) { int i; - A_UINT32 val; + u32 val; for (i=0; i<AR6003_FETCH_TARG_REGS_COUNT; i++) { val=0xffffffff; @@ -329,13 +329,13 @@ ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs) } #if 0 -static A_STATUS -_do_write_diag(HIF_DEVICE *hifDevice, A_UINT32 addr, A_UINT32 value) +static int +_do_write_diag(struct hif_device *hifDevice, u32 addr, u32 value) { - A_STATUS status; + int status; status = ar6000_WriteRegDiag(hifDevice, &addr, &value); - if (status != A_OK) + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Cannot force Target to execute ROM!\n")); } @@ -357,12 +357,12 @@ _do_write_diag(HIF_DEVICE *hifDevice, A_UINT32 addr, A_UINT32 value) * TBD: Might want to add special handling for AR6K_OPTION_BMI_DISABLE. */ #if 0 -static A_STATUS -_delay_until_target_alive(HIF_DEVICE *hifDevice, A_INT32 wait_msecs, A_UINT32 TargetType) +static int +_delay_until_target_alive(struct hif_device *hifDevice, s32 wait_msecs, u32 TargetType) { - A_INT32 actual_wait; - A_INT32 i; - A_UINT32 address; + s32 actual_wait; + s32 i; + u32 address; actual_wait = 0; @@ -376,19 +376,19 @@ _delay_until_target_alive(HIF_DEVICE *hifDevice, A_INT32 wait_msecs, A_UINT32 Ta } address += 0x10; for (i=0; actual_wait < wait_msecs; i++) { - A_UINT32 data; + u32 data; A_MDELAY(100); actual_wait += 100; data = 0; - if (ar6000_ReadRegDiag(hifDevice, &address, &data) != A_OK) { + if (ar6000_ReadRegDiag(hifDevice, &address, &data) != 0) { return A_ERROR; } if (data != 0) { /* No need to wait longer -- we have a BMI credit */ - return A_OK; + return 0; } } return A_ERROR; /* timed out */ @@ -399,11 +399,11 @@ _delay_until_target_alive(HIF_DEVICE *hifDevice, A_INT32 wait_msecs, A_UINT32 Ta #define AR6002_RESET_CONTROL_ADDRESS 0x00004000 #define AR6003_RESET_CONTROL_ADDRESS 0x00004000 /* reset device */ -A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL waitForCompletion, A_BOOL coldReset) +int ar6000_reset_device(struct hif_device *hifDevice, u32 TargetType, bool waitForCompletion, bool coldReset) { - A_STATUS status = A_OK; - A_UINT32 address; - A_UINT32 data; + int status = 0; + u32 address; + u32 data; do { // Workaround BEGIN @@ -428,7 +428,7 @@ A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL status = ar6000_WriteRegDiag(hifDevice, &address, &data); - if (A_FAILED(status)) { + if (status) { break; } @@ -458,7 +458,7 @@ A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL data = 0; status = ar6000_ReadRegDiag(hifDevice, &address, &data); - if (A_FAILED(status)) { + if (status) { break; } @@ -470,27 +470,27 @@ A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL #endif // Workaroud END - } while (FALSE); + } while (false); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR, ("Failed to reset target \n")); } - return A_OK; + return 0; } /* This should be called in BMI phase after firmware is downloaded */ void -ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType) +ar6000_copy_cust_data_from_target(struct hif_device *hifDevice, u32 TargetType) { - A_UINT32 eepHeaderAddr; - A_UINT8 AR6003CustDataShadow[AR6003_CUST_DATA_SIZE+4]; - A_INT32 i; + u32 eepHeaderAddr; + u8 AR6003CustDataShadow[AR6003_CUST_DATA_SIZE+4]; + s32 i; if (BMIReadMemory(hifDevice, HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_board_data), - (A_UCHAR *)&eepHeaderAddr, - 4)!= A_OK) + (u8 *)&eepHeaderAddr, + 4)!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMIReadMemory for reading board data address failed \n")); return; @@ -500,7 +500,7 @@ ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType) eepHeaderAddr += 36; /* AR6003 customer data section offset is 37 */ for (i=0; i<AR6003_CUST_DATA_SIZE+4; i+=4){ - if (BMIReadSOCRegister(hifDevice, eepHeaderAddr, (A_UINT32 *)&AR6003CustDataShadow[i])!= A_OK) { + if (BMIReadSOCRegister(hifDevice, eepHeaderAddr, (u32 *)&AR6003CustDataShadow[i])!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMIReadSOCRegister () failed \n")); return ; } @@ -514,7 +514,7 @@ ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType) eepHeaderAddr += 64; /* AR6002 customer data sectioin offset is 64 */ for (i=0; i<AR6002_CUST_DATA_SIZE; i+=4){ - if (BMIReadSOCRegister(hifDevice, eepHeaderAddr, (A_UINT32 *)&custDataAR6002[i])!= A_OK) { + if (BMIReadSOCRegister(hifDevice, eepHeaderAddr, (u32 *)&custDataAR6002[i])!= 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMIReadSOCRegister () failed \n")); return ; } @@ -526,8 +526,7 @@ ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType) } /* This is the function to call when need to use the cust data */ -A_UINT8 * -ar6000_get_cust_data_buffer(A_UINT32 TargetType) +u8 *ar6000_get_cust_data_buffer(u32 TargetType) { if (TargetType == TARGET_TYPE_AR6003) return custDataAR6003; @@ -553,14 +552,14 @@ ar6000_get_cust_data_buffer(A_UINT32 TargetType) #endif -void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType) +void ar6000_dump_target_assert_info(struct hif_device *hifDevice, u32 TargetType) { - A_UINT32 address; - A_UINT32 regDumpArea = 0; - A_STATUS status; - A_UINT32 regDumpValues[REGISTER_DUMP_LEN_MAX]; - A_UINT32 regDumpCount = 0; - A_UINT32 i; + u32 address; + u32 regDumpArea = 0; + int status; + u32 regDumpValues[REGISTER_DUMP_LEN_MAX]; + u32 regDumpCount = 0; + u32 i; do { @@ -579,7 +578,7 @@ void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType) /* read RAM location through diagnostic window */ status = ar6000_ReadRegDiag(hifDevice, &address, ®DumpArea); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Failed to get ptr to register dump area \n")); break; } @@ -596,10 +595,10 @@ void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType) /* fetch register dump data */ status = ar6000_ReadDataDiag(hifDevice, regDumpArea, - (A_UCHAR *)®DumpValues[0], - regDumpCount * (sizeof(A_UINT32))); + (u8 *)®DumpValues[0], + regDumpCount * (sizeof(u32))); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("AR6K: Failed to get register dump \n")); break; } @@ -619,26 +618,26 @@ void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType) #endif } - } while (FALSE); + } while (false); } /* set HTC/Mbox operational parameters, this can only be called when the target is in the * BMI phase */ -A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 MboxIsrYieldValue, - A_UINT8 HtcControlBuffers) +int ar6000_set_htc_params(struct hif_device *hifDevice, + u32 TargetType, + u32 MboxIsrYieldValue, + u8 HtcControlBuffers) { - A_STATUS status; - A_UINT32 blocksizes[HTC_MAILBOX_NUM_MAX]; + int status; + u32 blocksizes[HTC_MAILBOX_NUM_MAX]; do { /* get the block sizes */ status = HIFConfigureDevice(hifDevice, HIF_DEVICE_GET_MBOX_BLOCK_SIZE, blocksizes, sizeof(blocksizes)); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR,("Failed to get block size info from HIF layer...\n")); break; } @@ -649,16 +648,16 @@ A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice, if (HtcControlBuffers != 0) { /* set override for number of control buffers to use */ - blocksizes[1] |= ((A_UINT32)HtcControlBuffers) << 16; + blocksizes[1] |= ((u32)HtcControlBuffers) << 16; } /* set the host interest area for the block size */ status = BMIWriteMemory(hifDevice, HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_mbox_io_block_sz), - (A_UCHAR *)&blocksizes[1], + (u8 *)&blocksizes[1], 4); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR,("BMIWriteMemory for IO block size failed \n")); break; } @@ -670,33 +669,33 @@ A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice, /* set the host interest area for the mbox ISR yield limit */ status = BMIWriteMemory(hifDevice, HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_mbox_isr_yield_limit), - (A_UCHAR *)&MboxIsrYieldValue, + (u8 *)&MboxIsrYieldValue, 4); - if (A_FAILED(status)) { + if (status) { AR_DEBUG_PRINTF(ATH_LOG_ERR,("BMIWriteMemory for yield limit failed \n")); break; } } - } while (FALSE); + } while (false); return status; } -static A_STATUS prepare_ar6002(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) +static int prepare_ar6002(struct hif_device *hifDevice, u32 TargetVersion) { - A_STATUS status = A_OK; + int status = 0; /* placeholder */ return status; } -static A_STATUS prepare_ar6003(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) +static int prepare_ar6003(struct hif_device *hifDevice, u32 TargetVersion) { - A_STATUS status = A_OK; + int status = 0; /* placeholder */ @@ -704,9 +703,9 @@ static A_STATUS prepare_ar6003(HIF_DEVICE *hifDevice, A_UINT32 TargetVersion) } /* this function assumes the caller has already initialized the BMI APIs */ -A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 TargetVersion) +int ar6000_prepare_target(struct hif_device *hifDevice, + u32 TargetType, + u32 TargetVersion) { if (TargetType == TARGET_TYPE_AR6002) { /* do any preparations for AR6002 devices */ @@ -715,7 +714,7 @@ A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice, return prepare_ar6003(hifDevice,TargetVersion); } - return A_OK; + return 0; } #if defined(CONFIG_AR6002_REV1_FORCE_HOST) @@ -725,19 +724,19 @@ A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice, * THIS IS FOR USE ONLY WITH AR6002 REV 1.x. * TBDXXX: Remove this function when REV 1.x is desupported. */ -A_STATUS -ar6002_REV1_reset_force_host (HIF_DEVICE *hifDevice) +int +ar6002_REV1_reset_force_host (struct hif_device *hifDevice) { - A_INT32 i; + s32 i; struct forceROM_s { - A_UINT32 addr; - A_UINT32 data; + u32 addr; + u32 data; }; struct forceROM_s *ForceROM; - A_INT32 szForceROM; - A_STATUS status = A_OK; - A_UINT32 address; - A_UINT32 data; + s32 szForceROM; + int status = 0; + u32 address; + u32 data; /* Force AR6002 REV1.x to recognize Host presence. * @@ -771,7 +770,7 @@ ar6002_REV1_reset_force_host (HIF_DEVICE *hifDevice) address = 0x004ed4b0; /* REV1 target software ID is stored here */ status = ar6000_ReadRegDiag(hifDevice, &address, &data); - if (A_FAILED(status) || (data != AR6002_VERSION_REV1)) { + if (status || (data != AR6002_VERSION_REV1)) { return A_ERROR; /* Not AR6002 REV1 */ } @@ -783,7 +782,7 @@ ar6002_REV1_reset_force_host (HIF_DEVICE *hifDevice) { if (ar6000_WriteRegDiag(hifDevice, &ForceROM[i].addr, - &ForceROM[i].data) != A_OK) + &ForceROM[i].data) != 0) { ATH_DEBUG_PRINTF (DBG_MISC_DRV, ATH_DEBUG_TRC, ("Cannot force Target to recognize Host!\n")); return A_ERROR; @@ -792,17 +791,17 @@ ar6002_REV1_reset_force_host (HIF_DEVICE *hifDevice) A_MDELAY(1000); - return A_OK; + return 0; } #endif /* CONFIG_AR6002_REV1_FORCE_HOST */ -void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription) +void DebugDumpBytes(u8 *buffer, u16 length, char *pDescription) { - A_CHAR stream[60]; - A_CHAR byteOffsetStr[10]; - A_UINT32 i; - A_UINT16 offset, count, byteOffset; + char stream[60]; + char byteOffsetStr[10]; + u32 i; + u16 offset, count, byteOffset; A_PRINTF("<---------Dumping %d Bytes : %s ------>\n", length, pDescription); @@ -835,7 +834,7 @@ void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription) void a_dump_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo) { int i; - ATH_DEBUG_MASK_DESCRIPTION *pDesc; + struct ath_debug_mask_description *pDesc; if (pInfo == NULL) { return; @@ -868,7 +867,7 @@ void a_dump_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo) } -static ATH_DEBUG_MODULE_DBG_INFO *FindModule(A_CHAR *module_name) +static ATH_DEBUG_MODULE_DBG_INFO *FindModule(char *module_name) { ATH_DEBUG_MODULE_DBG_INFO *pInfo = g_pModuleInfoHead; @@ -878,7 +877,7 @@ static ATH_DEBUG_MODULE_DBG_INFO *FindModule(A_CHAR *module_name) while (pInfo != NULL) { /* TODO: need to use something other than strlen */ - if (A_MEMCMP(pInfo->ModuleName,module_name,strlen(module_name)) == 0) { + if (memcmp(pInfo->ModuleName,module_name,strlen(module_name)) == 0) { break; } pInfo = pInfo->pNext; @@ -909,7 +908,7 @@ void a_register_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo) A_MUTEX_UNLOCK(&g_ModuleListLock); } -void a_dump_module_debug_info_by_name(A_CHAR *module_name) +void a_dump_module_debug_info_by_name(char *module_name) { ATH_DEBUG_MODULE_DBG_INFO *pInfo = g_pModuleInfoHead; @@ -917,7 +916,7 @@ void a_dump_module_debug_info_by_name(A_CHAR *module_name) return; } - if (A_MEMCMP(module_name,"all",3) == 0) { + if (memcmp(module_name,"all",3) == 0) { /* dump all */ while (pInfo != NULL) { a_dump_module_debug_info(pInfo); @@ -934,7 +933,7 @@ void a_dump_module_debug_info_by_name(A_CHAR *module_name) } -A_STATUS a_get_module_mask(A_CHAR *module_name, A_UINT32 *pMask) +int a_get_module_mask(char *module_name, u32 *pMask) { ATH_DEBUG_MODULE_DBG_INFO *pInfo = FindModule(module_name); @@ -943,10 +942,10 @@ A_STATUS a_get_module_mask(A_CHAR *module_name, A_UINT32 *pMask) } *pMask = pInfo->CurrentMask; - return A_OK; + return 0; } -A_STATUS a_set_module_mask(A_CHAR *module_name, A_UINT32 Mask) +int a_set_module_mask(char *module_name, u32 Mask) { ATH_DEBUG_MODULE_DBG_INFO *pInfo = FindModule(module_name); @@ -956,7 +955,7 @@ A_STATUS a_set_module_mask(A_CHAR *module_name, A_UINT32 Mask) pInfo->CurrentMask = Mask; A_PRINTF("Module %s, new mask: 0x%8.8X \n",module_name,pInfo->CurrentMask); - return A_OK; + return 0; } @@ -967,7 +966,7 @@ void a_module_debug_support_init(void) } A_MUTEX_INIT(&g_ModuleListLock); g_pModuleInfoHead = NULL; - g_ModuleDebugInit = TRUE; + g_ModuleDebugInit = true; A_REGISTER_MODULE_DEBUG_INFO(misc); } @@ -980,7 +979,7 @@ void a_module_debug_support_cleanup(void) return; } - g_ModuleDebugInit = FALSE; + g_ModuleDebugInit = false; A_MUTEX_LOCK(&g_ModuleListLock); @@ -999,11 +998,11 @@ void a_module_debug_support_cleanup(void) } /* can only be called during bmi init stage */ -A_STATUS ar6000_set_hci_bridge_flags(HIF_DEVICE *hifDevice, - A_UINT32 TargetType, - A_UINT32 Flags) +int ar6000_set_hci_bridge_flags(struct hif_device *hifDevice, + u32 TargetType, + u32 Flags) { - A_STATUS status = A_OK; + int status = 0; do { @@ -1016,11 +1015,11 @@ A_STATUS ar6000_set_hci_bridge_flags(HIF_DEVICE *hifDevice, /* set hci bridge flags */ status = BMIWriteMemory(hifDevice, HOST_INTEREST_ITEM_ADDRESS(TargetType, hi_hci_bridge_flags), - (A_UCHAR *)&Flags, + (u8 *)&Flags, 4); - } while (FALSE); + } while (false); return status; } diff --git a/drivers/staging/ath6kl/miscdrv/credit_dist.c b/drivers/staging/ath6kl/miscdrv/credit_dist.c index 91316e0..ae54e1f 100644 --- a/drivers/staging/ath6kl/miscdrv/credit_dist.c +++ b/drivers/staging/ath6kl/miscdrv/credit_dist.c @@ -41,15 +41,15 @@ #define DATA_SVCS_USED 4 #endif -static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList); +static void RedistributeCredits(struct common_credit_state_info *pCredInfo, + struct htc_endpoint_credit_dist *pEPDistList); -static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList); +static void SeekCredits(struct common_credit_state_info *pCredInfo, + struct htc_endpoint_credit_dist *pEPDistList); /* reduce an ep's credits back to a set limit */ -static INLINE void ReduceCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEpDist, +static INLINE void ReduceCredits(struct common_credit_state_info *pCredInfo, + struct htc_endpoint_credit_dist *pEpDist, int Limit) { int credits; @@ -81,12 +81,12 @@ static INLINE void ReduceCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, * This function is called in the context of HTCStart() to setup initial (application-specific) * credit distributions */ static void ar6000_credit_init(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPList, + struct htc_endpoint_credit_dist *pEPList, int TotalCredits) { - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; + struct htc_endpoint_credit_dist *pCurEpDist; int count; - COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context; + struct common_credit_state_info *pCredInfo = (struct common_credit_state_info *)Context; pCredInfo->CurrentFreeCredits = TotalCredits; pCredInfo->TotalAvailableCredits = TotalCredits; @@ -136,7 +136,7 @@ static void ar6000_credit_init(void *Context, if (pCredInfo->CurrentFreeCredits <= 0) { AR_DEBUG_PRINTF(ATH_LOG_INF, ("Not enough credits (%d) to do credit distributions \n", TotalCredits)); - A_ASSERT(FALSE); + A_ASSERT(false); return; } @@ -175,11 +175,11 @@ static void ar6000_credit_init(void *Context, * */ static void ar6000_credit_distribute(void *Context, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList, + struct htc_endpoint_credit_dist *pEPDistList, HTC_CREDIT_DIST_REASON Reason) { - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; - COMMON_CREDIT_STATE_INFO *pCredInfo = (COMMON_CREDIT_STATE_INFO *)Context; + struct htc_endpoint_credit_dist *pCurEpDist; + struct common_credit_state_info *pCredInfo = (struct common_credit_state_info *)Context; switch (Reason) { case HTC_CREDIT_DIST_SEND_COMPLETE : @@ -243,10 +243,10 @@ static void ar6000_credit_distribute(void *Context, } /* redistribute credits based on activity change */ -static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDistList) +static void RedistributeCredits(struct common_credit_state_info *pCredInfo, + struct htc_endpoint_credit_dist *pEPDistList) { - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist = pEPDistList; + struct htc_endpoint_credit_dist *pCurEpDist = pEPDistList; /* walk through the list and remove credits from inactive endpoints */ while (pCurEpDist != NULL) { @@ -283,10 +283,10 @@ static void RedistributeCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, } /* HTC has an endpoint that needs credits, pEPDist is the endpoint in question */ -static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, - HTC_ENDPOINT_CREDIT_DIST *pEPDist) +static void SeekCredits(struct common_credit_state_info *pCredInfo, + struct htc_endpoint_credit_dist *pEPDist) { - HTC_ENDPOINT_CREDIT_DIST *pCurEpDist; + struct htc_endpoint_credit_dist *pCurEpDist; int credits = 0; int need; @@ -382,7 +382,7 @@ static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, /* return what we can get */ credits = min(pCredInfo->CurrentFreeCredits,pEPDist->TxCreditsSeek); - } while (FALSE); + } while (false); /* did we find some credits? */ if (credits) { @@ -393,11 +393,11 @@ static void SeekCredits(COMMON_CREDIT_STATE_INFO *pCredInfo, } /* initialize and setup credit distribution */ -A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO *pCredInfo) +int ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, struct common_credit_state_info *pCredInfo) { HTC_SERVICE_ID servicepriority[5]; - A_MEMZERO(pCredInfo,sizeof(COMMON_CREDIT_STATE_INFO)); + A_MEMZERO(pCredInfo,sizeof(struct common_credit_state_info)); servicepriority[0] = WMI_CONTROL_SVC; /* highest */ servicepriority[1] = WMI_DATA_VO_SVC; @@ -413,6 +413,6 @@ A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO servicepriority, 5); - return A_OK; + return 0; } diff --git a/drivers/staging/ath6kl/miscdrv/miscdrv.h b/drivers/staging/ath6kl/miscdrv/miscdrv.h index ae24b72..41be567 100644 --- a/drivers/staging/ath6kl/miscdrv/miscdrv.h +++ b/drivers/staging/ath6kl/miscdrv/miscdrv.h @@ -27,7 +27,7 @@ #define HOST_INTEREST_ITEM_ADDRESS(target, item) \ AR6002_HOST_INTEREST_ITEM_ADDRESS(item) -A_UINT32 ar6kRev2Array[][128] = { +u32 ar6kRev2Array[][128] = { {0xFFFF, 0xFFFF}, // No Patches }; |