diff options
Diffstat (limited to 'drivers/staging/ath6kl/miscdrv/ar3kps')
-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 |
4 files changed, 166 insertions, 174 deletions
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 */ |