Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6

* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (961 commits)
  staging: hv: fix memory leaks
  staging: hv: Remove NULL check before kfree
  Staging: hv: Get rid of vmbus_child_dev_add()
  Staging: hv: Change the signature for vmbus_child_device_register()
  Staging: hv: Get rid of vmbus_cleanup() function
  Staging: hv: Get rid of vmbus_dev_rm() function
  Staging: hv: Change the signature for vmbus_on_isr()
  Staging: hv: Eliminate vmbus_event_dpc()
  Staging: hv: Get rid of the function vmbus_msg_dpc()
  Staging: hv: Change the signature for vmbus_cleanup()
  Staging: hv: Simplify root device management
  staging: rtl8192e: Don't copy dev pointer to skb
  staging: rtl8192e: Pass priv to cmdpkt functions
  staging: rtl8192e: Pass priv to firmware download functions
  staging: rtl8192e: Pass priv to rtl8192_interrupt
  staging: rtl8192e: Pass rtl8192_priv to dm functions
  staging: rtl8192e: Pass ieee80211_device to callbacks
  staging: rtl8192e: Pass ieee80211_device to callbacks
  staging: rtl8192e: Pass ieee80211_device to callbacks
  staging: rtl8192e: Pass ieee80211_device to callbacks
  ...
This commit is contained in:
Linus Torvalds 2011-03-16 15:19:35 -07:00
commit 6445ced867
835 changed files with 93675 additions and 90275 deletions

View File

@ -3613,12 +3613,6 @@ W: http://lse.sourceforge.net/kdump/
S: Maintained
F: Documentation/kdump/
KERNEL AUTOMOUNTER (AUTOFS)
M: "H. Peter Anvin" <hpa@zytor.com>
L: autofs@linux.kernel.org
S: Obsolete
F: drivers/staging/autofs/
KERNEL AUTOMOUNTER v4 (AUTOFS4)
M: Ian Kent <raven@themaw.net>
L: autofs@linux.kernel.org

View File

@ -219,4 +219,14 @@ config BT_ATH3K
Say Y here to compile support for "Atheros firmware download driver"
into the kernel or say M to compile it as module (ath3k).
config BT_WILINK
tristate "Texas Instruments WiLink7 driver"
depends on TI_ST
help
This enables the Bluetooth driver for Texas Instrument's BT/FM/GPS
combo devices. This makes use of shared transport line discipline
core driver to communicate with the BT core of the combo chip.
Say Y here to compile support for Texas Instrument's WiLink7 driver
into the kernel or say M to compile it as module.
endmenu

View File

@ -18,6 +18,7 @@ obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
obj-$(CONFIG_BT_ATH3K) += ath3k.o
obj-$(CONFIG_BT_MRVL) += btmrvl.o
obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o
obj-$(CONFIG_BT_WILINK) += btwilink.o
btmrvl-y := btmrvl_main.o
btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o

View File

@ -0,0 +1,395 @@
/*
* Texas Instrument's Bluetooth Driver For Shared Transport.
*
* Bluetooth Driver acts as interface between HCI core and
* TI Shared Transport Layer.
*
* Copyright (C) 2009-2010 Texas Instruments
* Author: Raja Mani <raja_mani@ti.com>
* Pavan Savoy <pavan_savoy@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define DEBUG
#include <linux/platform_device.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <net/bluetooth/hci.h>
#include <linux/ti_wilink_st.h>
/* Bluetooth Driver Version */
#define VERSION "1.0"
#define MAX_BT_CHNL_IDS 3
/* Number of seconds to wait for registration completion
* when ST returns PENDING status.
*/
#define BT_REGISTER_TIMEOUT 6000 /* 6 sec */
/**
* struct ti_st - driver operation structure
* @hdev: hci device pointer which binds to bt driver
* @reg_status: ST registration callback status
* @st_write: write function provided by the ST driver
* to be used by the driver during send_frame.
* @wait_reg_completion - completion sync between ti_st_open
* and st_reg_completion_cb.
*/
struct ti_st {
struct hci_dev *hdev;
char reg_status;
long (*st_write) (struct sk_buff *);
struct completion wait_reg_completion;
};
/* Increments HCI counters based on pocket ID (cmd,acl,sco) */
static inline void ti_st_tx_complete(struct ti_st *hst, int pkt_type)
{
struct hci_dev *hdev = hst->hdev;
/* Update HCI stat counters */
switch (pkt_type) {
case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++;
break;
case HCI_ACLDATA_PKT:
hdev->stat.acl_tx++;
break;
case HCI_SCODATA_PKT:
hdev->stat.sco_tx++;
break;
}
}
/* ------- Interfaces to Shared Transport ------ */
/* Called by ST layer to indicate protocol registration completion
* status.ti_st_open() function will wait for signal from this
* API when st_register() function returns ST_PENDING.
*/
static void st_reg_completion_cb(void *priv_data, char data)
{
struct ti_st *lhst = priv_data;
/* Save registration status for use in ti_st_open() */
lhst->reg_status = data;
/* complete the wait in ti_st_open() */
complete(&lhst->wait_reg_completion);
}
/* Called by Shared Transport layer when receive data is
* available */
static long st_receive(void *priv_data, struct sk_buff *skb)
{
struct ti_st *lhst = priv_data;
int err;
if (!skb)
return -EFAULT;
if (!lhst) {
kfree_skb(skb);
return -EFAULT;
}
skb->dev = (void *) lhst->hdev;
/* Forward skb to HCI core layer */
err = hci_recv_frame(skb);
if (err < 0) {
BT_ERR("Unable to push skb to HCI core(%d)", err);
return err;
}
lhst->hdev->stat.byte_rx += skb->len;
return 0;
}
/* ------- Interfaces to HCI layer ------ */
/* protocol structure registered with shared transport */
static struct st_proto_s ti_st_proto[MAX_BT_CHNL_IDS] = {
{
.chnl_id = HCI_ACLDATA_PKT, /* ACL */
.hdr_len = sizeof(struct hci_acl_hdr),
.offset_len_in_hdr = offsetof(struct hci_acl_hdr, dlen),
.len_size = 2, /* sizeof(dlen) in struct hci_acl_hdr */
.reserve = 8,
},
{
.chnl_id = HCI_SCODATA_PKT, /* SCO */
.hdr_len = sizeof(struct hci_sco_hdr),
.offset_len_in_hdr = offsetof(struct hci_sco_hdr, dlen),
.len_size = 1, /* sizeof(dlen) in struct hci_sco_hdr */
.reserve = 8,
},
{
.chnl_id = HCI_EVENT_PKT, /* HCI Events */
.hdr_len = sizeof(struct hci_event_hdr),
.offset_len_in_hdr = offsetof(struct hci_event_hdr, plen),
.len_size = 1, /* sizeof(plen) in struct hci_event_hdr */
.reserve = 8,
},
};
/* Called from HCI core to initialize the device */
static int ti_st_open(struct hci_dev *hdev)
{
unsigned long timeleft;
struct ti_st *hst;
int err, i;
BT_DBG("%s %p", hdev->name, hdev);
if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
/* provide contexts for callbacks from ST */
hst = hdev->driver_data;
for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
ti_st_proto[i].priv_data = hst;
ti_st_proto[i].max_frame_size = HCI_MAX_FRAME_SIZE;
ti_st_proto[i].recv = st_receive;
ti_st_proto[i].reg_complete_cb = st_reg_completion_cb;
/* Prepare wait-for-completion handler */
init_completion(&hst->wait_reg_completion);
/* Reset ST registration callback status flag,
* this value will be updated in
* st_reg_completion_cb()
* function whenever it called from ST driver.
*/
hst->reg_status = -EINPROGRESS;
err = st_register(&ti_st_proto[i]);
if (!err)
goto done;
if (err != -EINPROGRESS) {
clear_bit(HCI_RUNNING, &hdev->flags);
BT_ERR("st_register failed %d", err);
return err;
}
/* ST is busy with either protocol
* registration or firmware download.
*/
BT_DBG("waiting for registration "
"completion signal from ST");
timeleft = wait_for_completion_timeout
(&hst->wait_reg_completion,
msecs_to_jiffies(BT_REGISTER_TIMEOUT));
if (!timeleft) {
clear_bit(HCI_RUNNING, &hdev->flags);
BT_ERR("Timeout(%d sec),didn't get reg "
"completion signal from ST",
BT_REGISTER_TIMEOUT / 1000);
return -ETIMEDOUT;
}
/* Is ST registration callback
* called with ERROR status? */
if (hst->reg_status != 0) {
clear_bit(HCI_RUNNING, &hdev->flags);
BT_ERR("ST registration completed with invalid "
"status %d", hst->reg_status);
return -EAGAIN;
}
done:
hst->st_write = ti_st_proto[i].write;
if (!hst->st_write) {
BT_ERR("undefined ST write function");
clear_bit(HCI_RUNNING, &hdev->flags);
for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
/* Undo registration with ST */
err = st_unregister(&ti_st_proto[i]);
if (err)
BT_ERR("st_unregister() failed with "
"error %d", err);
hst->st_write = NULL;
}
return -EIO;
}
}
return 0;
}
/* Close device */
static int ti_st_close(struct hci_dev *hdev)
{
int err, i;
struct ti_st *hst = hdev->driver_data;
if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
return 0;
for (i = 0; i < MAX_BT_CHNL_IDS; i++) {
err = st_unregister(&ti_st_proto[i]);
if (err)
BT_ERR("st_unregister(%d) failed with error %d",
ti_st_proto[i].chnl_id, err);
}
hst->st_write = NULL;
return err;
}
static int ti_st_send_frame(struct sk_buff *skb)
{
struct hci_dev *hdev;
struct ti_st *hst;
long len;
hdev = (struct hci_dev *)skb->dev;
if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;
hst = hdev->driver_data;
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type,
skb->len);
/* Insert skb to shared transport layer's transmit queue.
* Freeing skb memory is taken care in shared transport layer,
* so don't free skb memory here.
*/
len = hst->st_write(skb);
if (len < 0) {
kfree_skb(skb);
BT_ERR("ST write failed (%ld)", len);
/* Try Again, would only fail if UART has gone bad */
return -EAGAIN;
}
/* ST accepted our skb. So, Go ahead and do rest */
hdev->stat.byte_tx += len;
ti_st_tx_complete(hst, bt_cb(skb)->pkt_type);
return 0;
}
static void ti_st_destruct(struct hci_dev *hdev)
{
BT_DBG("%s", hdev->name);
/* do nothing here, since platform remove
* would free the hdev->driver_data
*/
}
static int bt_ti_probe(struct platform_device *pdev)
{
static struct ti_st *hst;
struct hci_dev *hdev;
int err;
hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL);
if (!hst)
return -ENOMEM;
/* Expose "hciX" device to user space */
hdev = hci_alloc_dev();
if (!hdev) {
kfree(hst);
return -ENOMEM;
}
BT_DBG("hdev %p", hdev);
hst->hdev = hdev;
hdev->bus = HCI_UART;
hdev->driver_data = hst;
hdev->open = ti_st_open;
hdev->close = ti_st_close;
hdev->flush = NULL;
hdev->send = ti_st_send_frame;
hdev->destruct = ti_st_destruct;
hdev->owner = THIS_MODULE;
err = hci_register_dev(hdev);
if (err < 0) {
BT_ERR("Can't register HCI device error %d", err);
kfree(hst);
hci_free_dev(hdev);
return err;
}
BT_DBG("HCI device registered (hdev %p)", hdev);
dev_set_drvdata(&pdev->dev, hst);
return err;
}
static int bt_ti_remove(struct platform_device *pdev)
{
struct hci_dev *hdev;
struct ti_st *hst = dev_get_drvdata(&pdev->dev);
if (!hst)
return -EFAULT;
BT_DBG("%s", hst->hdev->name);
hdev = hst->hdev;
ti_st_close(hdev);
hci_unregister_dev(hdev);
hci_free_dev(hdev);
kfree(hst);
dev_set_drvdata(&pdev->dev, NULL);
return 0;
}
static struct platform_driver btwilink_driver = {
.probe = bt_ti_probe,
.remove = bt_ti_remove,
.driver = {
.name = "btwilink",
.owner = THIS_MODULE,
},
};
/* ------- Module Init/Exit interfaces ------ */
static int __init btwilink_init(void)
{
BT_INFO("Bluetooth Driver for TI WiLink - Version %s", VERSION);
return platform_driver_register(&btwilink_driver);
}
static void __exit btwilink_exit(void)
{
platform_driver_unregister(&btwilink_driver);
}
module_init(btwilink_init);
module_exit(btwilink_exit);
/* ------ Module Info ------ */
MODULE_AUTHOR("Raja Mani <raja_mani@ti.com>");
MODULE_DESCRIPTION("Bluetooth Driver for TI Shared Transport" VERSION);
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");

View File

@ -48,7 +48,7 @@ void cn_queue_wrapper(struct work_struct *work)
}
static struct cn_callback_entry *
cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
cn_queue_alloc_callback_entry(const char *name, struct cb_id *id,
void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
struct cn_callback_entry *cbq;
@ -78,7 +78,8 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2)
return ((i1->idx == i2->idx) && (i1->val == i2->val));
}
int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
struct cb_id *id,
void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
struct cn_callback_entry *cbq, *__cbq;
@ -135,7 +136,7 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id)
}
}
struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls)
struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls)
{
struct cn_queue_dev *dev;

View File

@ -205,7 +205,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
*
* May sleep.
*/
int cn_add_callback(struct cb_id *id, char *name,
int cn_add_callback(struct cb_id *id, const char *name,
void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
int err;

View File

@ -91,12 +91,12 @@ source "drivers/staging/rtl8192e/Kconfig"
source "drivers/staging/rtl8712/Kconfig"
source "drivers/staging/rts_pstor/Kconfig"
source "drivers/staging/frontier/Kconfig"
source "drivers/staging/pohmelfs/Kconfig"
source "drivers/staging/autofs/Kconfig"
source "drivers/staging/phison/Kconfig"
source "drivers/staging/line6/Kconfig"
@ -131,6 +131,8 @@ source "drivers/staging/cs5535_gpio/Kconfig"
source "drivers/staging/zram/Kconfig"
source "drivers/staging/zcache/Kconfig"
source "drivers/staging/wlags49_h2/Kconfig"
source "drivers/staging/wlags49_h25/Kconfig"
@ -145,16 +147,12 @@ source "drivers/staging/crystalhd/Kconfig"
source "drivers/staging/cxt1e1/Kconfig"
source "drivers/staging/ti-st/Kconfig"
source "drivers/staging/xgifb/Kconfig"
source "drivers/staging/msm/Kconfig"
source "drivers/staging/lirc/Kconfig"
source "drivers/staging/smbfs/Kconfig"
source "drivers/staging/easycap/Kconfig"
source "drivers/staging/solo6x10/Kconfig"
@ -183,5 +181,7 @@ source "drivers/staging/cptm1217/Kconfig"
source "drivers/staging/ste_rmi4/Kconfig"
source "drivers/staging/gma500/Kconfig"
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING

View File

@ -29,14 +29,13 @@ obj-$(CONFIG_R8187SE) += rtl8187se/
obj-$(CONFIG_RTL8192U) += rtl8192u/
obj-$(CONFIG_RTL8192E) += rtl8192e/
obj-$(CONFIG_R8712U) += rtl8712/
obj-$(CONFIG_RTS_PSTOR) += rts_pstor/
obj-$(CONFIG_SPECTRA) += spectra/
obj-$(CONFIG_TRANZPORT) += frontier/
obj-$(CONFIG_POHMELFS) += pohmelfs/
obj-$(CONFIG_AUTOFS_FS) += autofs/
obj-$(CONFIG_IDE_PHISON) += phison/
obj-$(CONFIG_LINE6_USB) += line6/
obj-$(CONFIG_USB_SERIAL_QUATECH2) += serqt_usb2/
obj-$(CONFIG_SMB_FS) += smbfs/
obj-$(CONFIG_USB_SERIAL_QUATECH_USB2) += quatech_usb2/
obj-$(CONFIG_OCTEON_ETHERNET) += octeon/
obj-$(CONFIG_VT6655) += vt6655/
@ -48,6 +47,8 @@ obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/
obj-$(CONFIG_ZRAM) += zram/
obj-$(CONFIG_XVMALLOC) += zram/
obj-$(CONFIG_ZCACHE) += zcache/
obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/
obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/
obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/
@ -55,7 +56,6 @@ obj-$(CONFIG_FB_SM7XX) += sm7xx/
obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/
obj-$(CONFIG_CRYSTALHD) += crystalhd/
obj-$(CONFIG_CXT1E1) += cxt1e1/
obj-$(CONFIG_TI_ST) += ti-st/
obj-$(CONFIG_FB_XGI) += xgifb/
obj-$(CONFIG_MSM_STAGING) += msm/
obj-$(CONFIG_EASYCAP) += easycap/
@ -63,12 +63,13 @@ obj-$(CONFIG_SOLO6X10) += solo6x10/
obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/
obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/
obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/
obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/
obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
obj-$(CONFIG_USB_ENESTORAGE) += keucr/
obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_FT1000) += ft1000/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
obj-$(CONFIG_SPEAKUP) += speakup/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
obj-$(CONFIG_SPEAKUP) += speakup/
obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_DRM_PSB) += gma500/

View File

@ -1,8 +1,25 @@
- The driver is a stop-gap measure until a proper mac80211 driver is available.
- The driver does not conform to the Linux coding style.
- The driver has been tested on a wide variety of embedded platforms running different versions of the Linux kernel but may still have bringup/performance issues with a new platform.
- Pls use the following link to get information about the driver's architecture, exposed APIs, supported features, limitations, testing, hardware availability and other details.
http://wireless.kernel.org/en/users/Drivers/ath6kl
- Pls send any patches to
TODO:
We are working hard on cleaning up the driver. There's sooooooooo much todo
so instead of editign this file please use the wiki:
http://wireless.kernel.org/en/users/Drivers/ath6kl
There's a respective TODO page there. Please also subscribe to the wiki page
to get e-mail updates on changes.
IRC:
We *really* need to coordinate development for ath6kl as the cleanup
patches will break pretty much any other patches. Please use IRC to
help coordinate better:
irc.freenode.net
#ath6kl
Send patches to:
- Greg Kroah-Hartman <greg@kroah.com>
- Vipin Mehta <vmehta@atheros.com>
- Luis R. Rodriguez <mcgrof@gmail.com>
- Joe Perches <joe@perches.com>
- Naveen Singh <nsingh@atheros.com>

View File

@ -39,17 +39,17 @@
#define BMI_COMMUNICATION_TIMEOUT 100000
/* ------ Global Variable Declarations ------- */
static A_BOOL bmiDone;
static bool bmiDone;
A_STATUS
bmiBufferSend(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length);
int
bmiBufferSend(struct hif_device *device,
u8 *buffer,
u32 length);
A_STATUS
bmiBufferReceive(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length,
A_BOOL want_timeout);
int
bmiBufferReceive(struct hif_device *device,
u8 *buffer,
u32 length,
bool want_timeout);
#endif

View File

@ -33,7 +33,7 @@
#include "bmi_internal.h"
#ifdef ATH_DEBUG_MODULE
static ATH_DEBUG_MASK_DESCRIPTION bmi_debug_desc[] = {
static struct ath_debug_mask_description bmi_debug_desc[] = {
{ ATH_DEBUG_BMI , "BMI Tracing"},
};
@ -53,21 +53,21 @@ and does not use the HTC protocol nor even DMA -- it is intentionally kept
very simple.
*/
static A_BOOL pendingEventsFuncCheck = FALSE;
static A_UINT32 *pBMICmdCredits;
static A_UCHAR *pBMICmdBuf;
static bool pendingEventsFuncCheck = false;
static u32 *pBMICmdCredits;
static u8 *pBMICmdBuf;
#define MAX_BMI_CMDBUF_SZ (BMI_DATASZ_MAX + \
sizeof(A_UINT32) /* cmd */ + \
sizeof(A_UINT32) /* addr */ + \
sizeof(A_UINT32))/* length */
sizeof(u32) /* cmd */ + \
sizeof(u32) /* addr */ + \
sizeof(u32))/* length */
#define BMI_COMMAND_FITS(sz) ((sz) <= MAX_BMI_CMDBUF_SZ)
/* APIs visible to the driver */
void
BMIInit(void)
{
bmiDone = FALSE;
pendingEventsFuncCheck = FALSE;
bmiDone = false;
pendingEventsFuncCheck = false;
/*
* On some platforms, it's not possible to DMA to a static variable
@ -79,12 +79,12 @@ BMIInit(void)
* bus stack.
*/
if (!pBMICmdCredits) {
pBMICmdCredits = (A_UINT32 *)A_MALLOC_NOWAIT(4);
pBMICmdCredits = (u32 *)A_MALLOC_NOWAIT(4);
A_ASSERT(pBMICmdCredits);
}
if (!pBMICmdBuf) {
pBMICmdBuf = (A_UCHAR *)A_MALLOC_NOWAIT(MAX_BMI_CMDBUF_SZ);
pBMICmdBuf = (u8 *)A_MALLOC_NOWAIT(MAX_BMI_CMDBUF_SZ);
A_ASSERT(pBMICmdBuf);
}
@ -105,23 +105,23 @@ BMICleanup(void)
}
}
A_STATUS
BMIDone(HIF_DEVICE *device)
int
BMIDone(struct hif_device *device)
{
A_STATUS status;
A_UINT32 cid;
int status;
u32 cid;
if (bmiDone) {
AR_DEBUG_PRINTF (ATH_DEBUG_BMI, ("BMIDone skipped\n"));
return A_OK;
return 0;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Done: Enter (device: 0x%p)\n", device));
bmiDone = TRUE;
bmiDone = true;
cid = BMI_DONE;
status = bmiBufferSend(device, (A_UCHAR *)&cid, sizeof(cid));
if (status != A_OK) {
status = bmiBufferSend(device, (u8 *)&cid, sizeof(cid));
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
@ -138,14 +138,14 @@ BMIDone(HIF_DEVICE *device)
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Done: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info)
int
BMIGetTargetInfo(struct hif_device *device, struct bmi_target_info *targ_info)
{
A_STATUS status;
A_UINT32 cid;
int status;
u32 cid;
if (bmiDone) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Command disallowed\n"));
@ -155,24 +155,24 @@ BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info)
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Get Target Info: Enter (device: 0x%p)\n", device));
cid = BMI_GET_TARGET_INFO;
status = bmiBufferSend(device, (A_UCHAR *)&cid, sizeof(cid));
if (status != A_OK) {
status = bmiBufferSend(device, (u8 *)&cid, sizeof(cid));
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
status = bmiBufferReceive(device, (A_UCHAR *)&targ_info->target_ver,
sizeof(targ_info->target_ver), TRUE);
if (status != A_OK) {
status = bmiBufferReceive(device, (u8 *)&targ_info->target_ver,
sizeof(targ_info->target_ver), true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Version from the device\n"));
return A_ERROR;
}
if (targ_info->target_ver == TARGET_VERSION_SENTINAL) {
/* Determine how many bytes are in the Target's targ_info */
status = bmiBufferReceive(device, (A_UCHAR *)&targ_info->target_info_byte_count,
sizeof(targ_info->target_info_byte_count), TRUE);
if (status != A_OK) {
status = bmiBufferReceive(device, (u8 *)&targ_info->target_info_byte_count,
sizeof(targ_info->target_info_byte_count), true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Info Byte Count from the device\n"));
return A_ERROR;
}
@ -185,9 +185,9 @@ BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info)
/* Read the remainder of the targ_info */
status = bmiBufferReceive(device,
((A_UCHAR *)targ_info)+sizeof(targ_info->target_info_byte_count),
sizeof(*targ_info)-sizeof(targ_info->target_info_byte_count), TRUE);
if (status != A_OK) {
((u8 *)targ_info)+sizeof(targ_info->target_info_byte_count),
sizeof(*targ_info)-sizeof(targ_info->target_info_byte_count), true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read Target Info (%d bytes) from the device\n",
targ_info->target_info_byte_count));
return A_ERROR;
@ -197,19 +197,19 @@ BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info)
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Get Target Info: Exit (ver: 0x%x type: 0x%x)\n",
targ_info->target_ver, targ_info->target_type));
return A_OK;
return 0;
}
A_STATUS
BMIReadMemory(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length)
int
BMIReadMemory(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
A_UINT32 remaining, rxlen;
u32 cid;
int status;
u32 offset;
u32 remaining, rxlen;
A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + sizeof(cid) + sizeof(address) + sizeof(length)));
memset (pBMICmdBuf, 0, BMI_DATASZ_MAX + sizeof(cid) + sizeof(address) + sizeof(length));
@ -231,44 +231,44 @@ BMIReadMemory(HIF_DEVICE *device,
{
rxlen = (remaining < BMI_DATASZ_MAX) ? remaining : BMI_DATASZ_MAX;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
A_MEMCPY(&(pBMICmdBuf[offset]), &rxlen, sizeof(rxlen));
memcpy(&(pBMICmdBuf[offset]), &rxlen, sizeof(rxlen));
offset += sizeof(length);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
status = bmiBufferReceive(device, pBMICmdBuf, rxlen, TRUE);
if (status != A_OK) {
status = bmiBufferReceive(device, pBMICmdBuf, rxlen, true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n"));
return A_ERROR;
}
A_MEMCPY(&buffer[length - remaining], pBMICmdBuf, rxlen);
memcpy(&buffer[length - remaining], pBMICmdBuf, rxlen);
remaining -= rxlen; address += rxlen;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read Memory: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIWriteMemory(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length)
int
BMIWriteMemory(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
A_UINT32 remaining, txlen;
const A_UINT32 header = sizeof(cid) + sizeof(address) + sizeof(length);
A_UCHAR alignedBuffer[BMI_DATASZ_MAX];
A_UCHAR *src;
u32 cid;
int status;
u32 offset;
u32 remaining, txlen;
const u32 header = sizeof(cid) + sizeof(address) + sizeof(length);
u8 alignedBuffer[BMI_DATASZ_MAX];
u8 *src;
A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + header));
memset (pBMICmdBuf, 0, BMI_DATASZ_MAX + header);
@ -300,16 +300,16 @@ BMIWriteMemory(HIF_DEVICE *device,
txlen = (BMI_DATASZ_MAX - header);
}
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
A_MEMCPY(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen));
memcpy(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
A_MEMCPY(&(pBMICmdBuf[offset]), src, txlen);
memcpy(&(pBMICmdBuf[offset]), src, txlen);
offset += txlen;
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
@ -318,17 +318,17 @@ BMIWriteMemory(HIF_DEVICE *device,
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Write Memory: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIExecute(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 *param)
int
BMIExecute(struct hif_device *device,
u32 address,
u32 *param)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address) + sizeof(param)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address) + sizeof(param));
@ -345,37 +345,37 @@ BMIExecute(HIF_DEVICE *device,
cid = BMI_EXECUTE;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
A_MEMCPY(&(pBMICmdBuf[offset]), param, sizeof(*param));
memcpy(&(pBMICmdBuf[offset]), param, sizeof(*param));
offset += sizeof(*param);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*param), FALSE);
if (status != A_OK) {
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*param), false);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n"));
return A_ERROR;
}
A_MEMCPY(param, pBMICmdBuf, sizeof(*param));
memcpy(param, pBMICmdBuf, sizeof(*param));
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Execute: Exit (param: %d)\n", *param));
return A_OK;
return 0;
}
A_STATUS
BMISetAppStart(HIF_DEVICE *device,
A_UINT32 address)
int
BMISetAppStart(struct hif_device *device,
u32 address)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address));
@ -392,28 +392,28 @@ BMISetAppStart(HIF_DEVICE *device,
cid = BMI_SET_APP_START;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Set App Start: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIReadSOCRegister(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 *param)
int
BMIReadSOCRegister(struct hif_device *device,
u32 address,
u32 *param)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address));
@ -430,36 +430,36 @@ BMIReadSOCRegister(HIF_DEVICE *device,
cid = BMI_READ_SOC_REGISTER;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*param), TRUE);
if (status != A_OK) {
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*param), true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n"));
return A_ERROR;
}
A_MEMCPY(param, pBMICmdBuf, sizeof(*param));
memcpy(param, pBMICmdBuf, sizeof(*param));
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read SOC Register: Exit (value: %d)\n", *param));
return A_OK;
return 0;
}
A_STATUS
BMIWriteSOCRegister(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 param)
int
BMIWriteSOCRegister(struct hif_device *device,
u32 address,
u32 param)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address) + sizeof(param)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address) + sizeof(param));
@ -476,33 +476,33 @@ BMIWriteSOCRegister(HIF_DEVICE *device,
cid = BMI_WRITE_SOC_REGISTER;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
A_MEMCPY(&(pBMICmdBuf[offset]), &param, sizeof(param));
memcpy(&(pBMICmdBuf[offset]), &param, sizeof(param));
offset += sizeof(param);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Read SOC Register: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIrompatchInstall(HIF_DEVICE *device,
A_UINT32 ROM_addr,
A_UINT32 RAM_addr,
A_UINT32 nbytes,
A_UINT32 do_activate,
A_UINT32 *rompatch_id)
int
BMIrompatchInstall(struct hif_device *device,
u32 ROM_addr,
u32 RAM_addr,
u32 nbytes,
u32 do_activate,
u32 *rompatch_id)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(ROM_addr) + sizeof(RAM_addr) +
sizeof(nbytes) + sizeof(do_activate)));
@ -521,40 +521,40 @@ BMIrompatchInstall(HIF_DEVICE *device,
cid = BMI_ROMPATCH_INSTALL;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &ROM_addr, sizeof(ROM_addr));
memcpy(&(pBMICmdBuf[offset]), &ROM_addr, sizeof(ROM_addr));
offset += sizeof(ROM_addr);
A_MEMCPY(&(pBMICmdBuf[offset]), &RAM_addr, sizeof(RAM_addr));
memcpy(&(pBMICmdBuf[offset]), &RAM_addr, sizeof(RAM_addr));
offset += sizeof(RAM_addr);
A_MEMCPY(&(pBMICmdBuf[offset]), &nbytes, sizeof(nbytes));
memcpy(&(pBMICmdBuf[offset]), &nbytes, sizeof(nbytes));
offset += sizeof(nbytes);
A_MEMCPY(&(pBMICmdBuf[offset]), &do_activate, sizeof(do_activate));
memcpy(&(pBMICmdBuf[offset]), &do_activate, sizeof(do_activate));
offset += sizeof(do_activate);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*rompatch_id), TRUE);
if (status != A_OK) {
status = bmiBufferReceive(device, pBMICmdBuf, sizeof(*rompatch_id), true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read from the device\n"));
return A_ERROR;
}
A_MEMCPY(rompatch_id, pBMICmdBuf, sizeof(*rompatch_id));
memcpy(rompatch_id, pBMICmdBuf, sizeof(*rompatch_id));
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI rompatch Install: (rompatch_id=%d)\n", *rompatch_id));
return A_OK;
return 0;
}
A_STATUS
BMIrompatchUninstall(HIF_DEVICE *device,
A_UINT32 rompatch_id)
int
BMIrompatchUninstall(struct hif_device *device,
u32 rompatch_id)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(rompatch_id)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(rompatch_id));
@ -571,30 +571,30 @@ BMIrompatchUninstall(HIF_DEVICE *device,
cid = BMI_ROMPATCH_UNINSTALL;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &rompatch_id, sizeof(rompatch_id));
memcpy(&(pBMICmdBuf[offset]), &rompatch_id, sizeof(rompatch_id));
offset += sizeof(rompatch_id);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI rompatch UNinstall: (rompatch_id=0x%x)\n", rompatch_id));
return A_OK;
return 0;
}
static A_STATUS
_BMIrompatchChangeActivation(HIF_DEVICE *device,
A_UINT32 rompatch_count,
A_UINT32 *rompatch_list,
A_UINT32 do_activate)
static int
_BMIrompatchChangeActivation(struct hif_device *device,
u32 rompatch_count,
u32 *rompatch_list,
u32 do_activate)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
A_UINT32 length;
u32 cid;
int status;
u32 offset;
u32 length;
A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX + sizeof(cid) + sizeof(rompatch_count)));
memset(pBMICmdBuf, 0, BMI_DATASZ_MAX + sizeof(cid) + sizeof(rompatch_count));
@ -611,50 +611,50 @@ _BMIrompatchChangeActivation(HIF_DEVICE *device,
cid = do_activate ? BMI_ROMPATCH_ACTIVATE : BMI_ROMPATCH_DEACTIVATE;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &rompatch_count, sizeof(rompatch_count));
memcpy(&(pBMICmdBuf[offset]), &rompatch_count, sizeof(rompatch_count));
offset += sizeof(rompatch_count);
length = rompatch_count * sizeof(*rompatch_list);
A_MEMCPY(&(pBMICmdBuf[offset]), rompatch_list, length);
memcpy(&(pBMICmdBuf[offset]), rompatch_list, length);
offset += length;
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI Change rompatch Activation: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMIrompatchActivate(HIF_DEVICE *device,
A_UINT32 rompatch_count,
A_UINT32 *rompatch_list)
int
BMIrompatchActivate(struct hif_device *device,
u32 rompatch_count,
u32 *rompatch_list)
{
return _BMIrompatchChangeActivation(device, rompatch_count, rompatch_list, 1);
}
A_STATUS
BMIrompatchDeactivate(HIF_DEVICE *device,
A_UINT32 rompatch_count,
A_UINT32 *rompatch_list)
int
BMIrompatchDeactivate(struct hif_device *device,
u32 rompatch_count,
u32 *rompatch_list)
{
return _BMIrompatchChangeActivation(device, rompatch_count, rompatch_list, 0);
}
A_STATUS
BMILZData(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length)
int
BMILZData(struct hif_device *device,
u8 *buffer,
u32 length)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
A_UINT32 remaining, txlen;
const A_UINT32 header = sizeof(cid) + sizeof(length);
u32 cid;
int status;
u32 offset;
u32 remaining, txlen;
const u32 header = sizeof(cid) + sizeof(length);
A_ASSERT(BMI_COMMAND_FITS(BMI_DATASZ_MAX+header));
memset (pBMICmdBuf, 0, BMI_DATASZ_MAX+header);
@ -676,14 +676,14 @@ BMILZData(HIF_DEVICE *device,
txlen = (remaining < (BMI_DATASZ_MAX - header)) ?
remaining : (BMI_DATASZ_MAX - header);
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen));
memcpy(&(pBMICmdBuf[offset]), &txlen, sizeof(txlen));
offset += sizeof(txlen);
A_MEMCPY(&(pBMICmdBuf[offset]), &buffer[length - remaining], txlen);
memcpy(&(pBMICmdBuf[offset]), &buffer[length - remaining], txlen);
offset += txlen;
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to write to the device\n"));
return A_ERROR;
}
@ -692,16 +692,16 @@ BMILZData(HIF_DEVICE *device,
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI LZ Data: Exit\n"));
return A_OK;
return 0;
}
A_STATUS
BMILZStreamStart(HIF_DEVICE *device,
A_UINT32 address)
int
BMILZStreamStart(struct hif_device *device,
u32 address)
{
A_UINT32 cid;
A_STATUS status;
A_UINT32 offset;
u32 cid;
int status;
u32 offset;
A_ASSERT(BMI_COMMAND_FITS(sizeof(cid) + sizeof(address)));
memset (pBMICmdBuf, 0, sizeof(cid) + sizeof(address));
@ -717,31 +717,31 @@ BMILZStreamStart(HIF_DEVICE *device,
cid = BMI_LZ_STREAM_START;
offset = 0;
A_MEMCPY(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
memcpy(&(pBMICmdBuf[offset]), &cid, sizeof(cid));
offset += sizeof(cid);
A_MEMCPY(&(pBMICmdBuf[offset]), &address, sizeof(address));
memcpy(&(pBMICmdBuf[offset]), &address, sizeof(address));
offset += sizeof(address);
status = bmiBufferSend(device, pBMICmdBuf, offset);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to Start LZ Stream to the device\n"));
return A_ERROR;
}
AR_DEBUG_PRINTF(ATH_DEBUG_BMI, ("BMI LZ Stream Start: Exit\n"));
return A_OK;
return 0;
}
/* BMI Access routines */
A_STATUS
bmiBufferSend(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length)
int
bmiBufferSend(struct hif_device *device,
u8 *buffer,
u32 length)
{
A_STATUS status;
A_UINT32 timeout;
A_UINT32 address;
A_UINT32 mboxAddress[HTC_MAILBOX_NUM_MAX];
int status;
u32 timeout;
u32 address;
u32 mboxAddress[HTC_MAILBOX_NUM_MAX];
HIFConfigureDevice(device, HIF_DEVICE_GET_MBOX_ADDR,
&mboxAddress[0], sizeof(mboxAddress));
@ -755,9 +755,9 @@ bmiBufferSend(HIF_DEVICE *device,
/* hit the credit counter with a 4-byte access, the first byte read will hit the counter and cause
* a decrement, while the remaining 3 bytes has no effect. The rationale behind this is to
* make all HIF accesses 4-byte aligned */
status = HIFReadWrite(device, address, (A_UINT8 *)pBMICmdCredits, 4,
status = HIFReadWrite(device, address, (u8 *)pBMICmdCredits, 4,
HIF_RD_SYNC_BYTE_INC, NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to decrement the command credit count register\n"));
return A_ERROR;
}
@ -769,7 +769,7 @@ bmiBufferSend(HIF_DEVICE *device,
address = mboxAddress[ENDPOINT1];
status = HIFReadWrite(device, address, buffer, length,
HIF_WR_SYNC_BYTE_INC, NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to send the BMI data to the device\n"));
return A_ERROR;
}
@ -781,16 +781,16 @@ bmiBufferSend(HIF_DEVICE *device,
return status;
}
A_STATUS
bmiBufferReceive(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length,
A_BOOL want_timeout)
int
bmiBufferReceive(struct hif_device *device,
u8 *buffer,
u32 length,
bool want_timeout)
{
A_STATUS status;
A_UINT32 address;
A_UINT32 mboxAddress[HTC_MAILBOX_NUM_MAX];
HIF_PENDING_EVENTS_INFO hifPendingEvents;
int status;
u32 address;
u32 mboxAddress[HTC_MAILBOX_NUM_MAX];
struct hif_pending_events_info hifPendingEvents;
static HIF_PENDING_EVENTS_FUNC getPendingEventsFunc = NULL;
if (!pendingEventsFuncCheck) {
@ -800,7 +800,7 @@ bmiBufferReceive(HIF_DEVICE *device,
HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
&getPendingEventsFunc,
sizeof(getPendingEventsFunc));
pendingEventsFuncCheck = TRUE;
pendingEventsFuncCheck = true;
}
HIFConfigureDevice(device, HIF_DEVICE_GET_MBOX_ADDR,
@ -857,8 +857,8 @@ bmiBufferReceive(HIF_DEVICE *device,
* NB: word_available is declared static for esoteric reasons
* having to do with protection on some OSes.
*/
static A_UINT32 word_available;
A_UINT32 timeout;
static u32 word_available;
u32 timeout;
word_available = 0;
timeout = BMI_COMMUNICATION_TIMEOUT;
@ -868,20 +868,20 @@ bmiBufferReceive(HIF_DEVICE *device,
status = getPendingEventsFunc(device,
&hifPendingEvents,
NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("BMI: Failed to get pending events \n"));
break;
}
if (hifPendingEvents.AvailableRecvBytes >= sizeof(A_UINT32)) {
if (hifPendingEvents.AvailableRecvBytes >= sizeof(u32)) {
word_available = 1;
}
continue;
}
status = HIFReadWrite(device, RX_LOOKAHEAD_VALID_ADDRESS, (A_UINT8 *)&word_available,
status = HIFReadWrite(device, RX_LOOKAHEAD_VALID_ADDRESS, (u8 *)&word_available,
sizeof(word_available), HIF_RD_SYNC_BYTE_INC, NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read RX_LOOKAHEAD_VALID register\n"));
return A_ERROR;
}
@ -920,7 +920,7 @@ bmiBufferReceive(HIF_DEVICE *device,
* reduce BMI_DATASZ_MAX to 32 or 64
*/
if ((length > 4) && (length < 128)) { /* check against MBOX FIFO size */
A_UINT32 timeout;
u32 timeout;
*pBMICmdCredits = 0;
timeout = BMI_COMMUNICATION_TIMEOUT;
@ -930,9 +930,9 @@ bmiBufferReceive(HIF_DEVICE *device,
/* read the counter using a 4-byte read. Since the counter is NOT auto-decrementing,
* we can read this counter multiple times using a non-incrementing address mode.
* The rationale here is to make all HIF accesses a multiple of 4 bytes */
status = HIFReadWrite(device, address, (A_UINT8 *)pBMICmdCredits, sizeof(*pBMICmdCredits),
status = HIFReadWrite(device, address, (u8 *)pBMICmdCredits, sizeof(*pBMICmdCredits),
HIF_RD_SYNC_BYTE_FIX, NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read the command credit count register\n"));
return A_ERROR;
}
@ -949,62 +949,62 @@ bmiBufferReceive(HIF_DEVICE *device,
address = mboxAddress[ENDPOINT1];
status = HIFReadWrite(device, address, buffer, length, HIF_RD_SYNC_BYTE_INC, NULL);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to read the BMI data from the device\n"));
return A_ERROR;
}
return A_OK;
return 0;
}
A_STATUS
BMIFastDownload(HIF_DEVICE *device, A_UINT32 address, A_UCHAR *buffer, A_UINT32 length)
int
BMIFastDownload(struct hif_device *device, u32 address, u8 *buffer, u32 length)
{
A_STATUS status = A_ERROR;
A_UINT32 lastWord = 0;
A_UINT32 lastWordOffset = length & ~0x3;
A_UINT32 unalignedBytes = length & 0x3;
int status = A_ERROR;
u32 lastWord = 0;
u32 lastWordOffset = length & ~0x3;
u32 unalignedBytes = length & 0x3;
status = BMILZStreamStart (device, address);
if (A_FAILED(status)) {
if (status) {
return A_ERROR;
}
if (unalignedBytes) {
/* copy the last word into a zero padded buffer */
A_MEMCPY(&lastWord, &buffer[lastWordOffset], unalignedBytes);
memcpy(&lastWord, &buffer[lastWordOffset], unalignedBytes);
}
status = BMILZData(device, buffer, lastWordOffset);
if (A_FAILED(status)) {
if (status) {
return A_ERROR;
}
if (unalignedBytes) {
status = BMILZData(device, (A_UINT8 *)&lastWord, 4);
status = BMILZData(device, (u8 *)&lastWord, 4);
}
if (A_SUCCESS(status)) {
if (!status) {
//
// Close compressed stream and open a new (fake) one. This serves mainly to flush Target caches.
//
status = BMILZStreamStart (device, 0x00);
if (A_FAILED(status)) {
if (status) {
return A_ERROR;
}
}
return status;
}
A_STATUS
BMIRawWrite(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length)
int
BMIRawWrite(struct hif_device *device, u8 *buffer, u32 length)
{
return bmiBufferSend(device, buffer, length);
}
A_STATUS
BMIRawRead(HIF_DEVICE *device, A_UCHAR *buffer, A_UINT32 length, A_BOOL want_timeout)
int
BMIRawRead(struct hif_device *device, u8 *buffer, u32 length, bool want_timeout)
{
return bmiBufferReceive(device, buffer, length, want_timeout);
}

View File

@ -58,7 +58,7 @@
#define HIF_DEFAULT_IO_BLOCK_SIZE 128
/* set extended MBOX window information for SDIO interconnects */
static INLINE void SetExtendedMboxWindowInfo(A_UINT16 Manfid, HIF_DEVICE_MBOX_INFO *pInfo)
static INLINE void SetExtendedMboxWindowInfo(u16 Manfid, struct hif_device_mbox_info *pInfo)
{
switch (Manfid & MANUFACTURER_ID_AR6K_BASE_MASK) {
case MANUFACTURER_ID_AR6002_BASE :
@ -74,7 +74,7 @@ static INLINE void SetExtendedMboxWindowInfo(A_UINT16 Manfid, HIF_DEVICE_MBOX_IN
pInfo->GMboxSize = HIF_GMBOX_WIDTH;
break;
default:
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
}

View File

@ -47,19 +47,17 @@
#define HIF_MBOX2_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
#define HIF_MBOX3_BLOCK_SIZE HIF_MBOX_BLOCK_SIZE
struct _HIF_SCATTER_REQ_PRIV;
typedef struct bus_request {
struct bus_request *next; /* link list of available requests */
struct bus_request *inusenext; /* link list of in use requests */
struct semaphore sem_req;
A_UINT32 address; /* request data */
A_UCHAR *buffer;
A_UINT32 length;
A_UINT32 request;
u32 address; /* request data */
u8 *buffer;
u32 length;
u32 request;
void *context;
A_STATUS status;
struct _HIF_SCATTER_REQ_PRIV *pScatterReq; /* this request is a scatter request */
int status;
struct hif_scatter_req_priv *pScatterReq; /* this request is a scatter request */
} BUS_REQUEST;
struct hif_device {
@ -76,11 +74,11 @@ struct hif_device {
BUS_REQUEST busRequest[BUS_REQUEST_MAX_NUM]; /* available bus requests */
void *claimedContext;
HTC_CALLBACKS htcCallbacks;
A_UINT8 *dma_buffer;
DL_LIST ScatterReqHead; /* scatter request list head */
A_BOOL scatter_enabled; /* scatter enabled flag */
A_BOOL is_suspend;
A_BOOL is_disabled;
u8 *dma_buffer;
struct dl_list ScatterReqHead; /* scatter request list head */
bool scatter_enabled; /* scatter enabled flag */
bool is_suspend;
bool is_disabled;
atomic_t irqHandling;
HIF_DEVICE_POWER_CHANGE_TYPE powerConfig;
const struct sdio_device_id *id;
@ -90,9 +88,9 @@ struct hif_device {
#define CMD53_FIXED_ADDRESS 1
#define CMD53_INCR_ADDRESS 2
BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device);
void hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest);
void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest);
BUS_REQUEST *hifAllocateBusRequest(struct hif_device *device);
void hifFreeBusRequest(struct hif_device *device, BUS_REQUEST *busrequest);
void AddToAsyncList(struct hif_device *device, BUS_REQUEST *busrequest);
#ifdef HIF_LINUX_MMC_SCATTER_SUPPORT
@ -100,28 +98,28 @@ void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest);
#define MAX_SCATTER_ENTRIES_PER_REQ 16
#define MAX_SCATTER_REQ_TRANSFER_SIZE 32*1024
typedef struct _HIF_SCATTER_REQ_PRIV {
HIF_SCATTER_REQ *pHifScatterReq; /* HIF scatter request with allocated entries */
HIF_DEVICE *device; /* this device */
struct hif_scatter_req_priv {
struct hif_scatter_req *pHifScatterReq; /* HIF scatter request with allocated entries */
struct hif_device *device; /* this device */
BUS_REQUEST *busrequest; /* request associated with request */
/* scatter list for linux */
struct scatterlist sgentries[MAX_SCATTER_ENTRIES_PER_REQ];
} HIF_SCATTER_REQ_PRIV;
};
#define ATH_DEBUG_SCATTER ATH_DEBUG_MAKE_MODULE_MASK(0)
A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo);
void CleanupHIFScatterResources(HIF_DEVICE *device);
A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest);
int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo);
void CleanupHIFScatterResources(struct hif_device *device);
int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest);
#else // HIF_LINUX_MMC_SCATTER_SUPPORT
static inline A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo)
static inline int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo)
{
return A_ENOTSUP;
}
static inline A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
static inline int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest)
{
return A_ENOTSUP;
}

View File

@ -46,7 +46,7 @@
*/
#define BUFFER_NEEDS_BOUNCE(buffer) (((unsigned long)(buffer) & 0x3) || !virt_addr_valid((buffer)))
#else
#define BUFFER_NEEDS_BOUNCE(buffer) (FALSE)
#define BUFFER_NEEDS_BOUNCE(buffer) (false)
#endif
/* ATHENV */
@ -58,16 +58,16 @@ static int hifDeviceResume(struct device *dev);
#endif /* CONFIG_PM */
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id);
static void hifDeviceRemoved(struct sdio_func *func);
static HIF_DEVICE *addHifDevice(struct sdio_func *func);
static HIF_DEVICE *getHifDevice(struct sdio_func *func);
static void delHifDevice(HIF_DEVICE * device);
static struct hif_device *addHifDevice(struct sdio_func *func);
static struct hif_device *getHifDevice(struct sdio_func *func);
static void delHifDevice(struct hif_device * device);
static int Func0_CMD52WriteByte(struct mmc_card *card, unsigned int address, unsigned char byte);
static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsigned char *byte);
int reset_sdio_on_unload = 0;
module_param(reset_sdio_on_unload, int, 0644);
extern A_UINT32 nohifscattersupport;
extern u32 nohifscattersupport;
/* ------ Static Variables ------ */
@ -102,13 +102,13 @@ static struct dev_pm_ops ar6k_device_pm_ops = {
static int registered = 0;
OSDRV_CALLBACKS osdrvCallbacks;
extern A_UINT32 onebitmode;
extern A_UINT32 busspeedlow;
extern A_UINT32 debughif;
extern u32 onebitmode;
extern u32 busspeedlow;
extern u32 debughif;
static void ResetAllCards(void);
static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func);
static A_STATUS hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func);
static int hifDisableFunc(struct hif_device *device, struct sdio_func *func);
static int hifEnableFunc(struct hif_device *device, struct sdio_func *func);
#ifdef DEBUG
@ -123,7 +123,7 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(hif,
/* ------ Functions ------ */
A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks)
int HIFInit(OSDRV_CALLBACKS *callbacks)
{
int status;
AR_DEBUG_ASSERT(callbacks != NULL);
@ -148,23 +148,23 @@ A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks)
return A_ERROR;
}
return A_OK;
return 0;
}
static A_STATUS
__HIFReadWrite(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length,
A_UINT32 request,
static int
__HIFReadWrite(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length,
u32 request,
void *context)
{
A_UINT8 opcode;
A_STATUS status = A_OK;
u8 opcode;
int status = 0;
int ret;
A_UINT8 *tbuffer;
A_BOOL bounced = FALSE;
u8 *tbuffer;
bool bounced = false;
AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL);
@ -243,7 +243,7 @@ __HIFReadWrite(HIF_DEVICE *device,
/* copy the write data to the dma buffer */
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
memcpy(tbuffer, buffer, length);
bounced = TRUE;
bounced = true;
} else {
tbuffer = buffer;
}
@ -265,7 +265,7 @@ __HIFReadWrite(HIF_DEVICE *device,
AR_DEBUG_ASSERT(device->dma_buffer != NULL);
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
tbuffer = device->dma_buffer;
bounced = TRUE;
bounced = true;
} else {
tbuffer = buffer;
}
@ -299,12 +299,12 @@ __HIFReadWrite(HIF_DEVICE *device,
("AR6000: SDIO bus operation failed! MMC stack returned : %d \n", ret));
status = A_ERROR;
}
} while (FALSE);
} while (false);
return status;
}
void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest)
void AddToAsyncList(struct hif_device *device, BUS_REQUEST *busrequest)
{
unsigned long flags;
BUS_REQUEST *async;
@ -329,15 +329,15 @@ void AddToAsyncList(HIF_DEVICE *device, BUS_REQUEST *busrequest)
/* queue a read/write request */
A_STATUS
HIFReadWrite(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length,
A_UINT32 request,
int
HIFReadWrite(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length,
u32 request,
void *context)
{
A_STATUS status = A_OK;
int status = 0;
BUS_REQUEST *busrequest;
@ -375,7 +375,7 @@ HIFReadWrite(HIF_DEVICE *device,
/* interrupted, exit */
return A_ERROR;
} else {
A_STATUS status = busrequest->status;
int status = busrequest->status;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: sync return freeing 0x%lX: 0x%X\n",
(unsigned long)busrequest, busrequest->status));
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: freeing req: 0x%X\n", (unsigned int)request));
@ -400,12 +400,12 @@ HIFReadWrite(HIF_DEVICE *device,
/* thread to serialize all requests, both sync and async */
static int async_task(void *param)
{
HIF_DEVICE *device;
struct hif_device *device;
BUS_REQUEST *request;
A_STATUS status;
int status;
unsigned long flags;
device = (HIF_DEVICE *)param;
device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: async task\n"));
set_current_state(TASK_INTERRUPTIBLE);
while(!device->async_shutdown) {
@ -465,10 +465,10 @@ static int async_task(void *param)
return 0;
}
static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg, A_UINT32 flags, A_UINT32 *resp)
static s32 IssueSDCommand(struct hif_device *device, u32 opcode, u32 arg, u32 flags, u32 *resp)
{
struct mmc_command cmd;
A_INT32 err;
s32 err;
struct mmc_host *host;
struct sdio_func *func;
@ -488,14 +488,14 @@ static A_INT32 IssueSDCommand(HIF_DEVICE *device, A_UINT32 opcode, A_UINT32 arg,
return err;
}
A_STATUS ReinitSDIO(HIF_DEVICE *device)
int ReinitSDIO(struct hif_device *device)
{
A_INT32 err;
s32 err;
struct mmc_host *host;
struct mmc_card *card;
struct sdio_func *func;
A_UINT8 cmd52_resp;
A_UINT32 clock;
u8 cmd52_resp;
u32 clock;
func = device->func;
card = func->card;
@ -506,9 +506,9 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
do {
if (!device->is_suspend) {
A_UINT32 resp;
A_UINT16 rca;
A_UINT32 i;
u32 resp;
u16 rca;
u32 i;
int bit = fls(host->ocr_avail) - 1;
/* emulate the mmc_power_up(...) */
host->ios.vdd = bit;
@ -644,13 +644,13 @@ A_STATUS ReinitSDIO(HIF_DEVICE *device)
sdio_release_host(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -ReinitSDIO \n"));
return (err) ? A_ERROR : A_OK;
return (err) ? A_ERROR : 0;
}
A_STATUS
PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
int
PowerStateChangeNotify(struct hif_device *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
{
A_STATUS status = A_OK;
int status = 0;
#if defined(CONFIG_PM)
struct sdio_func *func = device->func;
int old_reset_val;
@ -678,7 +678,7 @@ PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
if (device->powerConfig == HIF_DEVICE_POWER_CUT) {
status = ReinitSDIO(device);
}
if (status == A_OK) {
if (status == 0) {
status = hifEnableFunc(device, func);
}
break;
@ -690,29 +690,29 @@ PowerStateChangeNotify(HIF_DEVICE *device, HIF_DEVICE_POWER_CHANGE_TYPE config)
return status;
}
A_STATUS
HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
void *config, A_UINT32 configLen)
int
HIFConfigureDevice(struct hif_device *device, HIF_DEVICE_CONFIG_OPCODE opcode,
void *config, u32 configLen)
{
A_UINT32 count;
A_STATUS status = A_OK;
u32 count;
int status = 0;
switch(opcode) {
case HIF_DEVICE_GET_MBOX_BLOCK_SIZE:
((A_UINT32 *)config)[0] = HIF_MBOX0_BLOCK_SIZE;
((A_UINT32 *)config)[1] = HIF_MBOX1_BLOCK_SIZE;
((A_UINT32 *)config)[2] = HIF_MBOX2_BLOCK_SIZE;
((A_UINT32 *)config)[3] = HIF_MBOX3_BLOCK_SIZE;
((u32 *)config)[0] = HIF_MBOX0_BLOCK_SIZE;
((u32 *)config)[1] = HIF_MBOX1_BLOCK_SIZE;
((u32 *)config)[2] = HIF_MBOX2_BLOCK_SIZE;
((u32 *)config)[3] = HIF_MBOX3_BLOCK_SIZE;
break;
case HIF_DEVICE_GET_MBOX_ADDR:
for (count = 0; count < 4; count ++) {
((A_UINT32 *)config)[count] = HIF_MBOX_START_ADDR(count);
((u32 *)config)[count] = HIF_MBOX_START_ADDR(count);
}
if (configLen >= sizeof(HIF_DEVICE_MBOX_INFO)) {
SetExtendedMboxWindowInfo((A_UINT16)device->func->device,
(HIF_DEVICE_MBOX_INFO *)config);
if (configLen >= sizeof(struct hif_device_mbox_info)) {
SetExtendedMboxWindowInfo((u16)device->func->device,
(struct hif_device_mbox_info *)config);
}
break;
@ -723,14 +723,14 @@ HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
if (!device->scatter_enabled) {
return A_ENOTSUP;
}
status = SetupHIFScatterSupport(device, (HIF_DEVICE_SCATTER_SUPPORT_INFO *)config);
if (A_FAILED(status)) {
device->scatter_enabled = FALSE;
status = SetupHIFScatterSupport(device, (struct hif_device_scatter_support_info *)config);
if (status) {
device->scatter_enabled = false;
}
break;
case HIF_DEVICE_GET_OS_DEVICE:
/* pass back a pointer to the SDIO function's "dev" struct */
((HIF_DEVICE_OS_DEVICE_INFO *)config)->pOSDevice = &device->func->dev;
((struct hif_device_os_device_info *)config)->pOSDevice = &device->func->dev;
break;
case HIF_DEVICE_POWER_STATE_CHANGE:
status = PowerStateChangeNotify(device, *(HIF_DEVICE_POWER_CHANGE_TYPE *)config);
@ -745,7 +745,7 @@ HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
}
void
HIFShutDownDevice(HIF_DEVICE *device)
HIFShutDownDevice(struct hif_device *device)
{
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +HIFShutDownDevice\n"));
if (device != NULL) {
@ -774,8 +774,8 @@ HIFShutDownDevice(HIF_DEVICE *device)
static void
hifIRQHandler(struct sdio_func *func)
{
A_STATUS status;
HIF_DEVICE *device;
int status;
struct hif_device *device;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifIRQHandler\n"));
device = getHifDevice(func);
@ -785,19 +785,19 @@ hifIRQHandler(struct sdio_func *func)
status = device->htcCallbacks.dsrHandler(device->htcCallbacks.context);
sdio_claim_host(device->func);
atomic_set(&device->irqHandling, 0);
AR_DEBUG_ASSERT(status == A_OK || status == A_ECANCELED);
AR_DEBUG_ASSERT(status == 0 || status == A_ECANCELED);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifIRQHandler\n"));
}
/* handle HTC startup via thread*/
static int startup_task(void *param)
{
HIF_DEVICE *device;
struct hif_device *device;
device = (HIF_DEVICE *)param;
device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call HTC from startup_task\n"));
/* start up inform DRV layer */
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != A_OK) {
if ((osdrvCallbacks.deviceInsertedHandler(osdrvCallbacks.context,device)) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
return 0;
@ -806,15 +806,15 @@ static int startup_task(void *param)
#if defined(CONFIG_PM)
static int enable_task(void *param)
{
HIF_DEVICE *device;
device = (HIF_DEVICE *)param;
struct hif_device *device;
device = (struct hif_device *)param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: call from resume_task\n"));
/* start up inform DRV layer */
if (device &&
device->claimedContext &&
osdrvCallbacks.devicePowerChangeHandler &&
osdrvCallbacks.devicePowerChangeHandler(device->claimedContext, HIF_DEVICE_POWER_UP) != A_OK)
osdrvCallbacks.devicePowerChangeHandler(device->claimedContext, HIF_DEVICE_POWER_UP) != 0)
{
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: Device rejected\n"));
}
@ -826,7 +826,7 @@ static int enable_task(void *param)
static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id *id)
{
int ret;
HIF_DEVICE * device;
struct hif_device * device;
int count;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
@ -837,7 +837,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
device = getHifDevice(func);
device->id = id;
device->is_disabled = TRUE;
device->is_disabled = true;
spin_lock_init(&device->lock);
@ -848,7 +848,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
if (!nohifscattersupport) {
/* try to allow scatter operation on all instances,
* unless globally overridden */
device->scatter_enabled = TRUE;
device->scatter_enabled = true;
}
/* Initialize the bus requests to be used later */
@ -866,7 +866,7 @@ static int hifDeviceInserted(struct sdio_func *func, const struct sdio_device_id
void
HIFAckInterrupt(HIF_DEVICE *device)
HIFAckInterrupt(struct hif_device *device)
{
AR_DEBUG_ASSERT(device != NULL);
@ -874,7 +874,7 @@ HIFAckInterrupt(HIF_DEVICE *device)
}
void
HIFUnMaskInterrupt(HIF_DEVICE *device)
HIFUnMaskInterrupt(struct hif_device *device)
{
int ret;
@ -890,7 +890,7 @@ HIFUnMaskInterrupt(HIF_DEVICE *device)
AR_DEBUG_ASSERT(ret == 0);
}
void HIFMaskInterrupt(HIF_DEVICE *device)
void HIFMaskInterrupt(struct hif_device *device)
{
int ret;
AR_DEBUG_ASSERT(device != NULL);
@ -910,7 +910,7 @@ void HIFMaskInterrupt(HIF_DEVICE *device)
AR_DEBUG_ASSERT(ret == 0);
}
BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device)
BUS_REQUEST *hifAllocateBusRequest(struct hif_device *device)
{
BUS_REQUEST *busrequest;
unsigned long flag;
@ -930,7 +930,7 @@ BUS_REQUEST *hifAllocateBusRequest(HIF_DEVICE *device)
}
void
hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest)
hifFreeBusRequest(struct hif_device *device, BUS_REQUEST *busrequest)
{
unsigned long flag;
@ -949,10 +949,10 @@ hifFreeBusRequest(HIF_DEVICE *device, BUS_REQUEST *busrequest)
spin_unlock_irqrestore(&device->lock, flag);
}
static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func)
static int hifDisableFunc(struct hif_device *device, struct sdio_func *func)
{
int ret;
A_STATUS status = A_OK;
int status = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDisableFunc\n"));
device = getHifDevice(func);
@ -988,20 +988,20 @@ static A_STATUS hifDisableFunc(HIF_DEVICE *device, struct sdio_func *func)
sdio_release_host(device->func);
if (status == A_OK) {
device->is_disabled = TRUE;
if (status == 0) {
device->is_disabled = true;
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDisableFunc\n"));
return status;
}
static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
static int hifEnableFunc(struct hif_device *device, struct sdio_func *func)
{
struct task_struct* pTask;
const char *taskName = NULL;
int (*taskFunc)(void *) = NULL;
int ret = A_OK;
int ret = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifEnableFunc\n"));
device = getHifDevice(func);
@ -1036,7 +1036,7 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
__FUNCTION__, HIF_MBOX_BLOCK_SIZE, ret));
return A_ERROR;
}
device->is_disabled = FALSE;
device->is_disabled = false;
/* create async I/O thread */
if (!device->async_task) {
device->async_shutdown = 0;
@ -1055,7 +1055,7 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
if (!device->claimedContext) {
taskFunc = startup_task;
taskName = "AR6K startup";
ret = A_OK;
ret = 0;
#if defined(CONFIG_PM)
} else {
taskFunc = enable_task;
@ -1080,22 +1080,23 @@ static int hifEnableFunc(HIF_DEVICE *device, struct sdio_func *func)
static int hifDeviceSuspend(struct device *dev)
{
struct sdio_func *func=dev_to_sdio_func(dev);
A_STATUS status = A_OK;
HIF_DEVICE *device;
int status = 0;
struct hif_device *device;
device = getHifDevice(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceSuspend\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
device->is_suspend = TRUE; /* set true first for PowerStateChangeNotify(..) */
device->is_suspend = true; /* set true first for PowerStateChangeNotify(..) */
status = osdrvCallbacks.deviceSuspendHandler(device->claimedContext);
if (status != A_OK) {
device->is_suspend = FALSE;
if (status) {
device->is_suspend = false;
}
}
CleanupHIFScatterResources(device);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceSuspend\n"));
switch (status) {
case A_OK:
case 0:
return 0;
case A_EBUSY:
return -EBUSY; /* Hack for kernel in order to support deep sleep and wow */
@ -1107,27 +1108,27 @@ static int hifDeviceSuspend(struct device *dev)
static int hifDeviceResume(struct device *dev)
{
struct sdio_func *func=dev_to_sdio_func(dev);
A_STATUS status = A_OK;
HIF_DEVICE *device;
int status = 0;
struct hif_device *device;
device = getHifDevice(func);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceResume\n"));
if (device && device->claimedContext && osdrvCallbacks.deviceSuspendHandler) {
status = osdrvCallbacks.deviceResumeHandler(device->claimedContext);
if (status == A_OK) {
device->is_suspend = FALSE;
if (status == 0) {
device->is_suspend = false;
}
}
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceResume\n"));
return A_SUCCESS(status) ? 0 : status;
return status;
}
#endif /* CONFIG_PM */
static void hifDeviceRemoved(struct sdio_func *func)
{
A_STATUS status = A_OK;
HIF_DEVICE *device;
int status = 0;
struct hif_device *device;
AR_DEBUG_ASSERT(func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: +hifDeviceRemoved\n"));
@ -1137,25 +1138,25 @@ static void hifDeviceRemoved(struct sdio_func *func)
}
if (device->is_disabled) {
device->is_disabled = FALSE;
device->is_disabled = false;
} else {
status = hifDisableFunc(device, func);
}
CleanupHIFScatterResources(device);
delHifDevice(device);
AR_DEBUG_ASSERT(status == A_OK);
AR_DEBUG_ASSERT(status == 0);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: -hifDeviceRemoved\n"));
}
/*
* This should be moved to AR6K HTC layer.
*/
A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
int hifWaitForPendingRecv(struct hif_device *device)
{
A_INT32 cnt = 10;
A_UINT8 host_int_status;
A_STATUS status = A_OK;
s32 cnt = 10;
u8 host_int_status;
int status = 0;
do {
while (atomic_read(&device->irqHandling)) {
@ -1165,9 +1166,9 @@ A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
/* check if there is any pending irq due to force done */
host_int_status = 0;
status = HIFReadWrite(device, HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&host_int_status, sizeof(host_int_status),
(u8 *)&host_int_status, sizeof(host_int_status),
HIF_RD_SYNC_BYTE_INC, NULL);
host_int_status = A_SUCCESS(status) ? (host_int_status & (1 << 0)) : 0;
host_int_status = !status ? (host_int_status & (1 << 0)) : 0;
if (host_int_status) {
schedule(); /* schedule for next dsrHandler */
}
@ -1178,17 +1179,17 @@ A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device)
("AR6000: %s(), Unable clear up pending IRQ before the system suspended\n", __FUNCTION__));
}
return A_OK;
return 0;
}
static HIF_DEVICE *
static struct hif_device *
addHifDevice(struct sdio_func *func)
{
HIF_DEVICE *hifdevice;
struct hif_device *hifdevice;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: addHifDevice\n"));
AR_DEBUG_ASSERT(func != NULL);
hifdevice = kzalloc(sizeof(HIF_DEVICE), GFP_KERNEL);
hifdevice = kzalloc(sizeof(struct hif_device), GFP_KERNEL);
AR_DEBUG_ASSERT(hifdevice != NULL);
#if HIF_USE_DMA_BOUNCE_BUFFER
hifdevice->dma_buffer = kmalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL);
@ -1201,21 +1202,19 @@ addHifDevice(struct sdio_func *func)
return hifdevice;
}
static HIF_DEVICE *
static struct hif_device *
getHifDevice(struct sdio_func *func)
{
AR_DEBUG_ASSERT(func != NULL);
return (HIF_DEVICE *)sdio_get_drvdata(func);
return (struct hif_device *)sdio_get_drvdata(func);
}
static void
delHifDevice(HIF_DEVICE * device)
delHifDevice(struct hif_device * device)
{
AR_DEBUG_ASSERT(device!= NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: delHifDevice; 0x%p\n", device));
if (device->dma_buffer != NULL) {
kfree(device->dma_buffer);
}
kfree(device->dma_buffer);
kfree(device);
}
@ -1223,27 +1222,27 @@ static void ResetAllCards(void)
{
}
void HIFClaimDevice(HIF_DEVICE *device, void *context)
void HIFClaimDevice(struct hif_device *device, void *context)
{
device->claimedContext = context;
}
void HIFReleaseDevice(HIF_DEVICE *device)
void HIFReleaseDevice(struct hif_device *device)
{
device->claimedContext = NULL;
}
A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks)
int HIFAttachHTC(struct hif_device *device, HTC_CALLBACKS *callbacks)
{
if (device->htcCallbacks.context != NULL) {
/* already in use! */
return A_ERROR;
}
device->htcCallbacks = *callbacks;
return A_OK;
return 0;
}
void HIFDetachHTC(HIF_DEVICE *device)
void HIFDetachHTC(struct hif_device *device)
{
A_MEMZERO(&device->htcCallbacks,sizeof(device->htcCallbacks));
}
@ -1280,7 +1279,7 @@ static int Func0_CMD52ReadByte(struct mmc_card *card, unsigned int address, unsi
{
struct mmc_command ioCmd;
unsigned long arg;
A_INT32 err;
s32 err;
memset(&ioCmd,0,sizeof(ioCmd));
SDIO_SET_CMD52_READ_ARG(arg,0,address);

View File

@ -48,7 +48,7 @@
(((address) & 0x1FFFF) << 9) | \
((bytes_blocks) & 0x1FF)
static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
static void FreeScatterReq(struct hif_device *device, struct hif_scatter_req *pReq)
{
unsigned long flag;
@ -60,9 +60,9 @@ static void FreeScatterReq(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
}
static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device)
static struct hif_scatter_req *AllocScatterReq(struct hif_device *device)
{
DL_LIST *pItem;
struct dl_list *pItem;
unsigned long flag;
spin_lock_irqsave(&device->lock, flag);
@ -72,24 +72,24 @@ static HIF_SCATTER_REQ *AllocScatterReq(HIF_DEVICE *device)
spin_unlock_irqrestore(&device->lock, flag);
if (pItem != NULL) {
return A_CONTAINING_STRUCT(pItem, HIF_SCATTER_REQ, ListLink);
return A_CONTAINING_STRUCT(pItem, struct hif_scatter_req, ListLink);
}
return NULL;
}
/* called by async task to perform the operation synchronously using direct MMC APIs */
A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
int DoHifReadWriteScatter(struct hif_device *device, BUS_REQUEST *busrequest)
{
int i;
A_UINT8 rw;
A_UINT8 opcode;
u8 rw;
u8 opcode;
struct mmc_request mmcreq;
struct mmc_command cmd;
struct mmc_data data;
HIF_SCATTER_REQ_PRIV *pReqPriv;
HIF_SCATTER_REQ *pReq;
A_STATUS status = A_OK;
struct hif_scatter_req_priv *pReqPriv;
struct hif_scatter_req *pReq;
int status = 0;
struct scatterlist *pSg;
pReqPriv = busrequest->pScatterReq;
@ -176,7 +176,7 @@ A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: data error: %d \n",data.error));
}
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, ("HIF-SCATTER: FAILED!!! (%s) Address: 0x%X, Block mode (BlockLen: %d, BlockCount: %d)\n",
(pReq->Request & HIF_WRITE) ? "WRITE":"READ",pReq->Address, data.blksz, data.blocks));
}
@ -199,11 +199,11 @@ A_STATUS DoHifReadWriteScatter(HIF_DEVICE *device, BUS_REQUEST *busrequest)
}
/* callback to issue a read-write scatter request */
static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
static int HifReadWriteScatter(struct hif_device *device, struct hif_scatter_req *pReq)
{
A_STATUS status = A_EINVAL;
A_UINT32 request = pReq->Request;
HIF_SCATTER_REQ_PRIV *pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0];
int status = A_EINVAL;
u32 request = pReq->Request;
struct hif_scatter_req_priv *pReqPriv = (struct hif_scatter_req_priv *)pReq->HIFPrivate[0];
do {
@ -237,7 +237,7 @@ static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
}
if (pReq->TotalLength == 0) {
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -260,26 +260,26 @@ static A_STATUS HifReadWriteScatter(HIF_DEVICE *device, HIF_SCATTER_REQ *pReq)
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, ("HIF-SCATTER: queued async req: 0x%lX\n", (unsigned long)pReqPriv->busrequest));
/* wake thread, it will process and then take care of the async callback */
up(&device->sem_async);
status = A_OK;
status = 0;
}
} while (FALSE);
} while (false);
if (A_FAILED(status) && (request & HIF_ASYNCHRONOUS)) {
if (status && (request & HIF_ASYNCHRONOUS)) {
pReq->CompletionStatus = status;
pReq->CompletionRoutine(pReq);
status = A_OK;
status = 0;
}
return status;
}
/* setup of HIF scatter resources */
A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_INFO *pInfo)
int SetupHIFScatterSupport(struct hif_device *device, struct hif_device_scatter_support_info *pInfo)
{
A_STATUS status = A_ERROR;
int status = A_ERROR;
int i;
HIF_SCATTER_REQ_PRIV *pReqPriv;
struct hif_scatter_req_priv *pReqPriv;
BUS_REQUEST *busrequest;
do {
@ -297,23 +297,23 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
for (i = 0; i < MAX_SCATTER_REQUESTS; i++) {
/* allocate the private request blob */
pReqPriv = (HIF_SCATTER_REQ_PRIV *)A_MALLOC(sizeof(HIF_SCATTER_REQ_PRIV));
pReqPriv = (struct hif_scatter_req_priv *)A_MALLOC(sizeof(struct hif_scatter_req_priv));
if (NULL == pReqPriv) {
break;
}
A_MEMZERO(pReqPriv, sizeof(HIF_SCATTER_REQ_PRIV));
A_MEMZERO(pReqPriv, sizeof(struct hif_scatter_req_priv));
/* save the device instance*/
pReqPriv->device = device;
/* allocate the scatter request */
pReqPriv->pHifScatterReq = (HIF_SCATTER_REQ *)A_MALLOC(sizeof(HIF_SCATTER_REQ) +
(MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(HIF_SCATTER_ITEM)));
pReqPriv->pHifScatterReq = (struct hif_scatter_req *)A_MALLOC(sizeof(struct hif_scatter_req) +
(MAX_SCATTER_ENTRIES_PER_REQ - 1) * (sizeof(struct hif_scatter_item)));
if (NULL == pReqPriv->pHifScatterReq) {
A_FREE(pReqPriv);
break;
}
/* just zero the main part of the scatter request */
A_MEMZERO(pReqPriv->pHifScatterReq, sizeof(HIF_SCATTER_REQ));
A_MEMZERO(pReqPriv->pHifScatterReq, sizeof(struct hif_scatter_req));
/* back pointer to the private struct */
pReqPriv->pHifScatterReq->HIFPrivate[0] = pReqPriv;
/* allocate a bus request for this scatter request */
@ -344,11 +344,11 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
pInfo->MaxScatterEntries = MAX_SCATTER_ENTRIES_PER_REQ;
pInfo->MaxTransferSizePerScatterReq = MAX_SCATTER_REQ_TRANSFER_SIZE;
status = A_OK;
status = 0;
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
CleanupHIFScatterResources(device);
}
@ -356,10 +356,10 @@ A_STATUS SetupHIFScatterSupport(HIF_DEVICE *device, HIF_DEVICE_SCATTER_SUPPORT_I
}
/* clean up scatter support */
void CleanupHIFScatterResources(HIF_DEVICE *device)
void CleanupHIFScatterResources(struct hif_device *device)
{
HIF_SCATTER_REQ_PRIV *pReqPriv;
HIF_SCATTER_REQ *pReq;
struct hif_scatter_req_priv *pReqPriv;
struct hif_scatter_req *pReq;
/* empty the free list */
@ -371,7 +371,7 @@ void CleanupHIFScatterResources(HIF_DEVICE *device)
break;
}
pReqPriv = (HIF_SCATTER_REQ_PRIV *)pReq->HIFPrivate[0];
pReqPriv = (struct hif_scatter_req_priv *)pReq->HIFPrivate[0];
A_ASSERT(pReqPriv != NULL);
if (pReqPriv->busrequest != NULL) {

File diff suppressed because it is too large Load Diff

View File

@ -43,40 +43,40 @@
//#define MBOXHW_UNIT_TEST 1
#include "athstartpack.h"
typedef PREPACK struct _AR6K_IRQ_PROC_REGISTERS {
A_UINT8 host_int_status;
A_UINT8 cpu_int_status;
A_UINT8 error_int_status;
A_UINT8 counter_int_status;
A_UINT8 mbox_frame;
A_UINT8 rx_lookahead_valid;
A_UINT8 host_int_status2;
A_UINT8 gmbox_rx_avail;
A_UINT32 rx_lookahead[2];
A_UINT32 rx_gmbox_lookahead_alias[2];
} POSTPACK AR6K_IRQ_PROC_REGISTERS;
PREPACK struct ar6k_irq_proc_registers {
u8 host_int_status;
u8 cpu_int_status;
u8 error_int_status;
u8 counter_int_status;
u8 mbox_frame;
u8 rx_lookahead_valid;
u8 host_int_status2;
u8 gmbox_rx_avail;
u32 rx_lookahead[2];
u32 rx_gmbox_lookahead_alias[2];
} POSTPACK;
#define AR6K_IRQ_PROC_REGS_SIZE sizeof(AR6K_IRQ_PROC_REGISTERS)
#define AR6K_IRQ_PROC_REGS_SIZE sizeof(struct ar6k_irq_proc_registers)
typedef PREPACK struct _AR6K_IRQ_ENABLE_REGISTERS {
A_UINT8 int_status_enable;
A_UINT8 cpu_int_status_enable;
A_UINT8 error_status_enable;
A_UINT8 counter_int_status_enable;
} POSTPACK AR6K_IRQ_ENABLE_REGISTERS;
PREPACK struct ar6k_irq_enable_registers {
u8 int_status_enable;
u8 cpu_int_status_enable;
u8 error_status_enable;
u8 counter_int_status_enable;
} POSTPACK;
typedef PREPACK struct _AR6K_GMBOX_CTRL_REGISTERS {
A_UINT8 int_status_enable;
} POSTPACK AR6K_GMBOX_CTRL_REGISTERS;
PREPACK struct ar6k_gmbox_ctrl_registers {
u8 int_status_enable;
} POSTPACK;
#include "athendpack.h"
#define AR6K_IRQ_ENABLE_REGS_SIZE sizeof(AR6K_IRQ_ENABLE_REGISTERS)
#define AR6K_IRQ_ENABLE_REGS_SIZE sizeof(struct ar6k_irq_enable_registers)
#define AR6K_REG_IO_BUFFER_SIZE 32
#define AR6K_MAX_REG_IO_BUFFERS 8
#define FROM_DMA_BUFFER TRUE
#define TO_DMA_BUFFER FALSE
#define FROM_DMA_BUFFER true
#define TO_DMA_BUFFER false
#define AR6K_SCATTER_ENTRIES_PER_REQ 16
#define AR6K_MAX_TRANSFER_SIZE_PER_SCATTER 16*1024
#define AR6K_SCATTER_REQS 4
@ -89,107 +89,107 @@ typedef PREPACK struct _AR6K_GMBOX_CTRL_REGISTERS {
#define AR6K_MIN_TRANSFER_SIZE_PER_SCATTER 4*1024
/* buffers for ASYNC I/O */
typedef struct AR6K_ASYNC_REG_IO_BUFFER {
HTC_PACKET HtcPacket; /* we use an HTC packet as a wrapper for our async register-based I/O */
A_UINT8 _Pad1[A_CACHE_LINE_PAD];
A_UINT8 Buffer[AR6K_REG_IO_BUFFER_SIZE]; /* cache-line safe with pads around */
A_UINT8 _Pad2[A_CACHE_LINE_PAD];
} AR6K_ASYNC_REG_IO_BUFFER;
struct ar6k_async_reg_io_buffer {
struct htc_packet HtcPacket; /* we use an HTC packet as a wrapper for our async register-based I/O */
u8 _Pad1[A_CACHE_LINE_PAD];
u8 Buffer[AR6K_REG_IO_BUFFER_SIZE]; /* cache-line safe with pads around */
u8 _Pad2[A_CACHE_LINE_PAD];
};
typedef struct _AR6K_GMBOX_INFO {
struct ar6k_gmbox_info {
void *pProtocolContext;
A_STATUS (*pMessagePendingCallBack)(void *pContext, A_UINT8 LookAheadBytes[], int ValidBytes);
A_STATUS (*pCreditsPendingCallback)(void *pContext, int NumCredits, A_BOOL CreditIRQEnabled);
void (*pTargetFailureCallback)(void *pContext, A_STATUS Status);
int (*pMessagePendingCallBack)(void *pContext, u8 LookAheadBytes[], int ValidBytes);
int (*pCreditsPendingCallback)(void *pContext, int NumCredits, bool CreditIRQEnabled);
void (*pTargetFailureCallback)(void *pContext, int Status);
void (*pStateDumpCallback)(void *pContext);
A_BOOL CreditCountIRQEnabled;
} AR6K_GMBOX_INFO;
bool CreditCountIRQEnabled;
};
typedef struct _AR6K_DEVICE {
struct ar6k_device {
A_MUTEX_T Lock;
A_UINT8 _Pad1[A_CACHE_LINE_PAD];
AR6K_IRQ_PROC_REGISTERS IrqProcRegisters; /* cache-line safe with pads around */
A_UINT8 _Pad2[A_CACHE_LINE_PAD];
AR6K_IRQ_ENABLE_REGISTERS IrqEnableRegisters; /* cache-line safe with pads around */
A_UINT8 _Pad3[A_CACHE_LINE_PAD];
u8 _Pad1[A_CACHE_LINE_PAD];
struct ar6k_irq_proc_registers IrqProcRegisters; /* cache-line safe with pads around */
u8 _Pad2[A_CACHE_LINE_PAD];
struct ar6k_irq_enable_registers IrqEnableRegisters; /* cache-line safe with pads around */
u8 _Pad3[A_CACHE_LINE_PAD];
void *HIFDevice;
A_UINT32 BlockSize;
A_UINT32 BlockMask;
HIF_DEVICE_MBOX_INFO MailBoxInfo;
u32 BlockSize;
u32 BlockMask;
struct hif_device_mbox_info MailBoxInfo;
HIF_PENDING_EVENTS_FUNC GetPendingEventsFunc;
void *HTCContext;
HTC_PACKET_QUEUE RegisterIOList;
AR6K_ASYNC_REG_IO_BUFFER RegIOBuffers[AR6K_MAX_REG_IO_BUFFERS];
struct htc_packet_queue RegisterIOList;
struct ar6k_async_reg_io_buffer RegIOBuffers[AR6K_MAX_REG_IO_BUFFERS];
void (*TargetFailureCallback)(void *Context);
A_STATUS (*MessagePendingCallback)(void *Context,
A_UINT32 LookAheads[],
int (*MessagePendingCallback)(void *Context,
u32 LookAheads[],
int NumLookAheads,
A_BOOL *pAsyncProc,
bool *pAsyncProc,
int *pNumPktsFetched);
HIF_DEVICE_IRQ_PROCESSING_MODE HifIRQProcessingMode;
HIF_MASK_UNMASK_RECV_EVENT HifMaskUmaskRecvEvent;
A_BOOL HifAttached;
HIF_DEVICE_IRQ_YIELD_PARAMS HifIRQYieldParams;
A_BOOL DSRCanYield;
bool HifAttached;
struct hif_device_irq_yield_params HifIRQYieldParams;
bool DSRCanYield;
int CurrentDSRRecvCount;
HIF_DEVICE_SCATTER_SUPPORT_INFO HifScatterInfo;
DL_LIST ScatterReqHead;
A_BOOL ScatterIsVirtual;
struct hif_device_scatter_support_info HifScatterInfo;
struct dl_list ScatterReqHead;
bool ScatterIsVirtual;
int MaxRecvBundleSize;
int MaxSendBundleSize;
AR6K_GMBOX_INFO GMboxInfo;
A_BOOL GMboxEnabled;
AR6K_GMBOX_CTRL_REGISTERS GMboxControlRegisters;
struct ar6k_gmbox_info GMboxInfo;
bool GMboxEnabled;
struct ar6k_gmbox_ctrl_registers GMboxControlRegisters;
int RecheckIRQStatusCnt;
} AR6K_DEVICE;
};
#define LOCK_AR6K(p) A_MUTEX_LOCK(&(p)->Lock);
#define UNLOCK_AR6K(p) A_MUTEX_UNLOCK(&(p)->Lock);
#define REF_IRQ_STATUS_RECHECK(p) (p)->RecheckIRQStatusCnt = 1 /* note: no need to lock this, it only gets set */
A_STATUS DevSetup(AR6K_DEVICE *pDev);
void DevCleanup(AR6K_DEVICE *pDev);
A_STATUS DevUnmaskInterrupts(AR6K_DEVICE *pDev);
A_STATUS DevMaskInterrupts(AR6K_DEVICE *pDev);
A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev,
A_UINT32 *pLookAhead,
int DevSetup(struct ar6k_device *pDev);
void DevCleanup(struct ar6k_device *pDev);
int DevUnmaskInterrupts(struct ar6k_device *pDev);
int DevMaskInterrupts(struct ar6k_device *pDev);
int DevPollMboxMsgRecv(struct ar6k_device *pDev,
u32 *pLookAhead,
int TimeoutMS);
A_STATUS DevRWCompletionHandler(void *context, A_STATUS status);
A_STATUS DevDsrHandler(void *context);
A_STATUS DevCheckPendingRecvMsgsAsync(void *context);
void DevAsyncIrqProcessComplete(AR6K_DEVICE *pDev);
void DevDumpRegisters(AR6K_DEVICE *pDev,
AR6K_IRQ_PROC_REGISTERS *pIrqProcRegs,
AR6K_IRQ_ENABLE_REGISTERS *pIrqEnableRegs);
int DevRWCompletionHandler(void *context, int status);
int DevDsrHandler(void *context);
int DevCheckPendingRecvMsgsAsync(void *context);
void DevAsyncIrqProcessComplete(struct ar6k_device *pDev);
void DevDumpRegisters(struct ar6k_device *pDev,
struct ar6k_irq_proc_registers *pIrqProcRegs,
struct ar6k_irq_enable_registers *pIrqEnableRegs);
#define DEV_STOP_RECV_ASYNC TRUE
#define DEV_STOP_RECV_SYNC FALSE
#define DEV_ENABLE_RECV_ASYNC TRUE
#define DEV_ENABLE_RECV_SYNC FALSE
A_STATUS DevStopRecv(AR6K_DEVICE *pDev, A_BOOL ASyncMode);
A_STATUS DevEnableRecv(AR6K_DEVICE *pDev, A_BOOL ASyncMode);
A_STATUS DevEnableInterrupts(AR6K_DEVICE *pDev);
A_STATUS DevDisableInterrupts(AR6K_DEVICE *pDev);
A_STATUS DevWaitForPendingRecv(AR6K_DEVICE *pDev,A_UINT32 TimeoutInMs,A_BOOL *pbIsRecvPending);
#define DEV_STOP_RECV_ASYNC true
#define DEV_STOP_RECV_SYNC false
#define DEV_ENABLE_RECV_ASYNC true
#define DEV_ENABLE_RECV_SYNC false
int DevStopRecv(struct ar6k_device *pDev, bool ASyncMode);
int DevEnableRecv(struct ar6k_device *pDev, bool ASyncMode);
int DevEnableInterrupts(struct ar6k_device *pDev);
int DevDisableInterrupts(struct ar6k_device *pDev);
int DevWaitForPendingRecv(struct ar6k_device *pDev,u32 TimeoutInMs,bool *pbIsRecvPending);
#define DEV_CALC_RECV_PADDED_LEN(pDev, length) (((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask)))
#define DEV_CALC_SEND_PADDED_LEN(pDev, length) DEV_CALC_RECV_PADDED_LEN(pDev,length)
#define DEV_IS_LEN_BLOCK_ALIGNED(pDev, length) (((length) % (pDev)->BlockSize) == 0)
static INLINE A_STATUS DevSendPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 SendLength) {
A_UINT32 paddedLength;
A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE;
A_STATUS status;
static INLINE int DevSendPacket(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 SendLength) {
u32 paddedLength;
bool sync = (pPacket->Completion == NULL) ? true : false;
int status;
/* adjust the length to be a multiple of block size if appropriate */
paddedLength = DEV_CALC_SEND_PADDED_LEN(pDev, SendLength);
#if 0
if (paddedLength > pPacket->BufferLength) {
A_ASSERT(FALSE);
A_ASSERT(false);
if (pPacket->Completion != NULL) {
COMPLETE_HTC_PACKET(pPacket,A_EINVAL);
return A_OK;
return 0;
}
return A_EINVAL;
}
@ -212,29 +212,29 @@ static INLINE A_STATUS DevSendPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_U
pPacket->Status = status;
} else {
if (status == A_PENDING) {
status = A_OK;
status = 0;
}
}
return status;
}
static INLINE A_STATUS DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 RecvLength) {
A_UINT32 paddedLength;
A_STATUS status;
A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE;
static INLINE int DevRecvPacket(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 RecvLength) {
u32 paddedLength;
int status;
bool sync = (pPacket->Completion == NULL) ? true : false;
/* adjust the length to be a multiple of block size if appropriate */
paddedLength = DEV_CALC_RECV_PADDED_LEN(pDev, RecvLength);
if (paddedLength > pPacket->BufferLength) {
A_ASSERT(FALSE);
A_ASSERT(false);
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DevRecvPacket, Not enough space for padlen:%d recvlen:%d bufferlen:%d \n",
paddedLength,RecvLength,pPacket->BufferLength));
if (pPacket->Completion != NULL) {
COMPLETE_HTC_PACKET(pPacket,A_EINVAL);
return A_OK;
return 0;
}
return A_EINVAL;
}
@ -272,27 +272,33 @@ static INLINE A_STATUS DevRecvPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_U
*
*/
A_STATUS DevCopyScatterListToFromDMABuffer(HIF_SCATTER_REQ *pReq, A_BOOL FromDMA);
int DevCopyScatterListToFromDMABuffer(struct hif_scatter_req *pReq, bool FromDMA);
/* copy any READ data back into scatter list */
#define DEV_FINISH_SCATTER_OPERATION(pR) \
if (A_SUCCESS((pR)->CompletionStatus) && \
!((pR)->Request & HIF_WRITE) && \
((pR)->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { \
(pR)->CompletionStatus = DevCopyScatterListToFromDMABuffer((pR),FROM_DMA_BUFFER); \
}
#define DEV_FINISH_SCATTER_OPERATION(pR) \
do { \
if (!((pR)->CompletionStatus) && \
!((pR)->Request & HIF_WRITE) && \
((pR)->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) { \
(pR)->CompletionStatus = \
DevCopyScatterListToFromDMABuffer((pR), \
FROM_DMA_BUFFER); \
} \
} while (0)
/* copy any WRITE data to bounce buffer */
static INLINE A_STATUS DEV_PREPARE_SCATTER_OPERATION(HIF_SCATTER_REQ *pReq) {
static INLINE int DEV_PREPARE_SCATTER_OPERATION(struct hif_scatter_req *pReq) {
if ((pReq->Request & HIF_WRITE) && (pReq->ScatterMethod == HIF_SCATTER_DMA_BOUNCE)) {
return DevCopyScatterListToFromDMABuffer(pReq,TO_DMA_BUFFER);
} else {
return A_OK;
return 0;
}
}
A_STATUS DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer);
int DevSetupMsgBundling(struct ar6k_device *pDev, int MaxMsgsPerTransfer);
int DevCleanupMsgBundling(struct ar6k_device *pDev);
#define DEV_GET_MAX_MSG_PER_BUNDLE(pDev) (pDev)->HifScatterInfo.MaxScatterEntries
#define DEV_GET_MAX_BUNDLE_LENGTH(pDev) (pDev)->HifScatterInfo.MaxTransferSizePerScatterReq
@ -305,25 +311,25 @@ A_STATUS DevSetupMsgBundling(AR6K_DEVICE *pDev, int MaxMsgsPerTransfer);
#define DEV_GET_MAX_BUNDLE_RECV_LENGTH(pDev) (pDev)->MaxRecvBundleSize
#define DEV_GET_MAX_BUNDLE_SEND_LENGTH(pDev) (pDev)->MaxSendBundleSize
#define DEV_SCATTER_READ TRUE
#define DEV_SCATTER_WRITE FALSE
#define DEV_SCATTER_ASYNC TRUE
#define DEV_SCATTER_SYNC FALSE
A_STATUS DevSubmitScatterRequest(AR6K_DEVICE *pDev, HIF_SCATTER_REQ *pScatterReq, A_BOOL Read, A_BOOL Async);
#define DEV_SCATTER_READ true
#define DEV_SCATTER_WRITE false
#define DEV_SCATTER_ASYNC true
#define DEV_SCATTER_SYNC false
int DevSubmitScatterRequest(struct ar6k_device *pDev, struct hif_scatter_req *pScatterReq, bool Read, bool Async);
#ifdef MBOXHW_UNIT_TEST
A_STATUS DoMboxHWTest(AR6K_DEVICE *pDev);
int DoMboxHWTest(struct ar6k_device *pDev);
#endif
/* completely virtual */
typedef struct _DEV_SCATTER_DMA_VIRTUAL_INFO {
A_UINT8 *pVirtDmaBuffer; /* dma-able buffer - CPU accessible address */
A_UINT8 DataArea[1]; /* start of data area */
} DEV_SCATTER_DMA_VIRTUAL_INFO;
struct dev_scatter_dma_virtual_info {
u8 *pVirtDmaBuffer; /* dma-able buffer - CPU accessible address */
u8 DataArea[1]; /* start of data area */
};
void DumpAR6KDevState(AR6K_DEVICE *pDev);
void DumpAR6KDevState(struct ar6k_device *pDev);
/**************************************************/
/****** GMBOX functions and definitions
@ -333,21 +339,21 @@ void DumpAR6KDevState(AR6K_DEVICE *pDev);
#ifdef ATH_AR6K_ENABLE_GMBOX
void DevCleanupGMbox(AR6K_DEVICE *pDev);
A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev);
A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev);
void DevNotifyGMboxTargetFailure(AR6K_DEVICE *pDev);
void DevCleanupGMbox(struct ar6k_device *pDev);
int DevSetupGMbox(struct ar6k_device *pDev);
int DevCheckGMboxInterrupts(struct ar6k_device *pDev);
void DevNotifyGMboxTargetFailure(struct ar6k_device *pDev);
#else
/* compiled out */
#define DevCleanupGMbox(p)
#define DevCheckGMboxInterrupts(p) A_OK
#define DevCheckGMboxInterrupts(p) 0
#define DevNotifyGMboxTargetFailure(p)
static INLINE A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev) {
pDev->GMboxEnabled = FALSE;
return A_OK;
static INLINE int DevSetupGMbox(struct ar6k_device *pDev) {
pDev->GMboxEnabled = false;
return 0;
}
#endif
@ -355,12 +361,12 @@ static INLINE A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev) {
#ifdef ATH_AR6K_ENABLE_GMBOX
/* GMBOX protocol modules must expose each of these internal APIs */
HCI_TRANSPORT_HANDLE GMboxAttachProtocol(AR6K_DEVICE *pDev, HCI_TRANSPORT_CONFIG_INFO *pInfo);
A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev);
void GMboxProtocolUninstall(AR6K_DEVICE *pDev);
HCI_TRANSPORT_HANDLE GMboxAttachProtocol(struct ar6k_device *pDev, struct hci_transport_config_info *pInfo);
int GMboxProtocolInstall(struct ar6k_device *pDev);
void GMboxProtocolUninstall(struct ar6k_device *pDev);
/* API used by GMBOX protocol modules */
AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle);
struct ar6k_device *HTCGetAR6KDevice(void *HTCHandle);
#define DEV_GMBOX_SET_PROTOCOL(pDev,recv_callback,credits_pending,failure,statedump,context) \
{ \
(pDev)->GMboxInfo.pProtocolContext = (context); \
@ -372,11 +378,11 @@ AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle);
#define DEV_GMBOX_GET_PROTOCOL(pDev) (pDev)->GMboxInfo.pProtocolContext
A_STATUS DevGMboxWrite(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 WriteLength);
A_STATUS DevGMboxRead(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ReadLength);
int DevGMboxWrite(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 WriteLength);
int DevGMboxRead(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 ReadLength);
#define PROC_IO_ASYNC TRUE
#define PROC_IO_SYNC FALSE
#define PROC_IO_ASYNC true
#define PROC_IO_SYNC false
typedef enum GMBOX_IRQ_ACTION_TYPE {
GMBOX_ACTION_NONE = 0,
GMBOX_DISABLE_ALL,
@ -387,11 +393,11 @@ typedef enum GMBOX_IRQ_ACTION_TYPE {
GMBOX_CREDIT_IRQ_DISABLE,
} GMBOX_IRQ_ACTION_TYPE;
A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE, A_BOOL AsyncMode);
A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits);
A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize);
A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer, int *pLookAheadBytes);
A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int SignalNumber, int AckTimeoutMS);
int DevGMboxIRQAction(struct ar6k_device *pDev, GMBOX_IRQ_ACTION_TYPE, bool AsyncMode);
int DevGMboxReadCreditCounter(struct ar6k_device *pDev, bool AsyncMode, int *pCredits);
int DevGMboxReadCreditSize(struct ar6k_device *pDev, int *pCreditSize);
int DevGMboxRecvLookAheadPeek(struct ar6k_device *pDev, u8 *pLookAheadBuffer, int *pLookAheadBytes);
int DevGMboxSetTargetInterrupt(struct ar6k_device *pDev, int SignalNumber, int AckTimeoutMS);
#endif

View File

@ -33,17 +33,17 @@
#include "htc_packet.h"
#include "ar6k.h"
extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket);
extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev);
extern void AR6KFreeIOPacket(struct ar6k_device *pDev, struct htc_packet *pPacket);
extern struct htc_packet *AR6KAllocIOPacket(struct ar6k_device *pDev);
static A_STATUS DevServiceDebugInterrupt(AR6K_DEVICE *pDev);
static int DevServiceDebugInterrupt(struct ar6k_device *pDev);
#define DELAY_PER_INTERVAL_MS 10 /* 10 MS delay per polling interval */
/* completion routine for ALL HIF layer async I/O */
A_STATUS DevRWCompletionHandler(void *context, A_STATUS status)
int DevRWCompletionHandler(void *context, int status)
{
HTC_PACKET *pPacket = (HTC_PACKET *)context;
struct htc_packet *pPacket = (struct htc_packet *)context;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("+DevRWCompletionHandler (Pkt:0x%lX) , Status: %d \n",
@ -55,26 +55,26 @@ A_STATUS DevRWCompletionHandler(void *context, A_STATUS status)
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("-DevRWCompletionHandler\n"));
return A_OK;
return 0;
}
/* mailbox recv message polling */
A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev,
A_UINT32 *pLookAhead,
int DevPollMboxMsgRecv(struct ar6k_device *pDev,
u32 *pLookAhead,
int TimeoutMS)
{
A_STATUS status = A_OK;
int status = 0;
int timeout = TimeoutMS/DELAY_PER_INTERVAL_MS;
A_ASSERT(timeout > 0);
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+DevPollMboxMsgRecv \n"));
while (TRUE) {
while (true) {
if (pDev->GetPendingEventsFunc != NULL) {
HIF_PENDING_EVENTS_INFO events;
struct hif_pending_events_info events;
#ifdef THREAD_X
events.Polling =1;
@ -85,7 +85,7 @@ A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev,
status = pDev->GetPendingEventsFunc(pDev->HIFDevice,
&events,
NULL);
if (A_FAILED(status))
if (status)
{
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to get pending events \n"));
break;
@ -104,12 +104,12 @@ A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev,
/* load the register table */
status = HIFReadWrite(pDev->HIFDevice,
HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&pDev->IrqProcRegisters,
(u8 *)&pDev->IrqProcRegisters,
AR6K_IRQ_PROC_REGS_SIZE,
HIF_RD_SYNC_BYTE_INC,
NULL);
if (A_FAILED(status)){
if (status){
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to read register table \n"));
break;
}
@ -152,11 +152,11 @@ A_STATUS DevPollMboxMsgRecv(AR6K_DEVICE *pDev,
return status;
}
static A_STATUS DevServiceCPUInterrupt(AR6K_DEVICE *pDev)
static int DevServiceCPUInterrupt(struct ar6k_device *pDev)
{
A_STATUS status;
A_UINT8 cpu_int_status;
A_UINT8 regBuffer[4];
int status;
u8 cpu_int_status;
u8 regBuffer[4];
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("CPU Interrupt\n"));
cpu_int_status = pDev->IrqProcRegisters.cpu_int_status &
@ -187,16 +187,16 @@ static A_STATUS DevServiceCPUInterrupt(AR6K_DEVICE *pDev)
HIF_WR_SYNC_BYTE_FIX,
NULL);
A_ASSERT(status == A_OK);
A_ASSERT(status == 0);
return status;
}
static A_STATUS DevServiceErrorInterrupt(AR6K_DEVICE *pDev)
static int DevServiceErrorInterrupt(struct ar6k_device *pDev)
{
A_STATUS status;
A_UINT8 error_int_status;
A_UINT8 regBuffer[4];
int status;
u8 error_int_status;
u8 regBuffer[4];
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("Error Interrupt\n"));
error_int_status = pDev->IrqProcRegisters.error_int_status & 0x0F;
@ -241,14 +241,14 @@ static A_STATUS DevServiceErrorInterrupt(AR6K_DEVICE *pDev)
HIF_WR_SYNC_BYTE_FIX,
NULL);
A_ASSERT(status == A_OK);
A_ASSERT(status == 0);
return status;
}
static A_STATUS DevServiceDebugInterrupt(AR6K_DEVICE *pDev)
static int DevServiceDebugInterrupt(struct ar6k_device *pDev)
{
A_UINT32 dummy;
A_STATUS status;
u32 dummy;
int status;
/* Send a target failure event to the application */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n"));
@ -266,18 +266,18 @@ static A_STATUS DevServiceDebugInterrupt(AR6K_DEVICE *pDev)
/* read counter to clear interrupt */
status = HIFReadWrite(pDev->HIFDevice,
COUNT_DEC_ADDRESS,
(A_UINT8 *)&dummy,
(u8 *)&dummy,
4,
HIF_RD_SYNC_BYTE_INC,
NULL);
A_ASSERT(status == A_OK);
A_ASSERT(status == 0);
return status;
}
static A_STATUS DevServiceCounterInterrupt(AR6K_DEVICE *pDev)
static int DevServiceCounterInterrupt(struct ar6k_device *pDev)
{
A_UINT8 counter_int_status;
u8 counter_int_status;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("Counter Interrupt\n"));
@ -296,21 +296,21 @@ static A_STATUS DevServiceCounterInterrupt(AR6K_DEVICE *pDev)
return DevServiceDebugInterrupt(pDev);
}
return A_OK;
return 0;
}
/* callback when our fetch to get interrupt status registers completes */
static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
static void DevGetEventAsyncHandler(void *Context, struct htc_packet *pPacket)
{
AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context;
A_UINT32 lookAhead = 0;
A_BOOL otherInts = FALSE;
struct ar6k_device *pDev = (struct ar6k_device *)Context;
u32 lookAhead = 0;
bool otherInts = false;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGetEventAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev));
do {
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" GetEvents I/O request failed, status:%d \n", pPacket->Status));
/* bail out, don't unmask HIF interrupt */
@ -319,7 +319,7 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
if (pDev->GetPendingEventsFunc != NULL) {
/* the HIF layer collected the information for us */
HIF_PENDING_EVENTS_INFO *pEvents = (HIF_PENDING_EVENTS_INFO *)pPacket->pBuffer;
struct hif_pending_events_info *pEvents = (struct hif_pending_events_info *)pPacket->pBuffer;
if (pEvents->Events & HIF_RECV_MSG_AVAIL) {
lookAhead = pEvents->LookAhead;
if (0 == lookAhead) {
@ -327,12 +327,12 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
}
}
if (pEvents->Events & HIF_OTHER_EVENTS) {
otherInts = TRUE;
otherInts = true;
}
} else {
/* standard interrupt table handling.... */
AR6K_IRQ_PROC_REGISTERS *pReg = (AR6K_IRQ_PROC_REGISTERS *)pPacket->pBuffer;
A_UINT8 host_int_status;
struct ar6k_irq_proc_registers *pReg = (struct ar6k_irq_proc_registers *)pPacket->pBuffer;
u8 host_int_status;
host_int_status = pReg->host_int_status & pDev->IrqEnableRegisters.int_status_enable;
@ -349,7 +349,7 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
if (host_int_status) {
/* there are other interrupts to handle */
otherInts = TRUE;
otherInts = true;
}
}
@ -363,7 +363,7 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
HIFAckInterrupt(pDev->HIFDevice);
} else {
int fetched = 0;
A_STATUS status;
int status;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
(" DevGetEventAsyncHandler : detected another message, lookahead :0x%X \n",
@ -372,14 +372,14 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
* go get the next message */
status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, NULL, &fetched);
if (A_SUCCESS(status) && !fetched) {
if (!status && !fetched) {
/* HTC layer could not pull out messages due to lack of resources, stop IRQ processing */
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("MessagePendingCallback did not pull any messages, force-ack \n"));
DevAsyncIrqProcessComplete(pDev);
}
}
} while (FALSE);
} while (false);
/* free this IO packet */
AR6KFreeIOPacket(pDev,pPacket);
@ -388,11 +388,11 @@ static void DevGetEventAsyncHandler(void *Context, HTC_PACKET *pPacket)
/* called by the HTC layer when it wants us to check if the device has any more pending
* recv messages, this starts off a series of async requests to read interrupt registers */
A_STATUS DevCheckPendingRecvMsgsAsync(void *context)
int DevCheckPendingRecvMsgsAsync(void *context)
{
AR6K_DEVICE *pDev = (AR6K_DEVICE *)context;
A_STATUS status = A_OK;
HTC_PACKET *pIOPacket;
struct ar6k_device *pDev = (struct ar6k_device *)context;
int status = 0;
struct htc_packet *pIOPacket;
/* this is called in an ASYNC only context, we may NOT block, sleep or call any apis that can
* cause us to switch contexts */
@ -428,7 +428,7 @@ A_STATUS DevCheckPendingRecvMsgsAsync(void *context)
/* there should be only 1 asynchronous request out at a time to read these registers
* so this should actually never happen */
status = A_NO_MEMORY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -439,7 +439,7 @@ A_STATUS DevCheckPendingRecvMsgsAsync(void *context)
if (pDev->GetPendingEventsFunc) {
/* HIF layer has it's own mechanism, pass the IO to it.. */
status = pDev->GetPendingEventsFunc(pDev->HIFDevice,
(HIF_PENDING_EVENTS_INFO *)pIOPacket->pBuffer,
(struct hif_pending_events_info *)pIOPacket->pBuffer,
pIOPacket);
} else {
@ -453,25 +453,25 @@ A_STATUS DevCheckPendingRecvMsgsAsync(void *context)
}
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,(" Async IO issued to get interrupt status...\n"));
} while (FALSE);
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevCheckPendingRecvMsgsAsync \n"));
return status;
}
void DevAsyncIrqProcessComplete(AR6K_DEVICE *pDev)
void DevAsyncIrqProcessComplete(struct ar6k_device *pDev)
{
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("DevAsyncIrqProcessComplete - forcing HIF IRQ ACK \n"));
HIFAckInterrupt(pDev->HIFDevice);
}
/* process pending interrupts synchronously */
static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pASyncProcessing)
static int ProcessPendingIRQs(struct ar6k_device *pDev, bool *pDone, bool *pASyncProcessing)
{
A_STATUS status = A_OK;
A_UINT8 host_int_status = 0;
A_UINT32 lookAhead = 0;
int status = 0;
u8 host_int_status = 0;
u32 lookAhead = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+ProcessPendingIRQs: (dev: 0x%lX)\n", (unsigned long)pDev));
@ -490,7 +490,7 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
}
if (pDev->GetPendingEventsFunc != NULL) {
HIF_PENDING_EVENTS_INFO events;
struct hif_pending_events_info events;
#ifdef THREAD_X
events.Polling= 0;
@ -501,7 +501,7 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
&events,
NULL);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -545,12 +545,12 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
#endif /* CONFIG_MMC_SDHCI_S3C */
status = HIFReadWrite(pDev->HIFDevice,
HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&pDev->IrqProcRegisters,
(u8 *)&pDev->IrqProcRegisters,
AR6K_IRQ_PROC_REGS_SIZE,
HIF_RD_SYNC_BYTE_INC,
NULL);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -591,19 +591,19 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
status = DevCheckGMboxInterrupts(pDev);
}
} while (FALSE);
} while (false);
do {
/* did the interrupt status fetches succeed? */
if (A_FAILED(status)) {
if (status) {
break;
}
if ((0 == host_int_status) && (0 == lookAhead)) {
/* nothing to process, the caller can use this to break out of a loop */
*pDone = TRUE;
*pDone = true;
break;
}
@ -617,14 +617,14 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
* completion routine of the callers read request. This can improve performance
* by reducing context switching when we rapidly pull packets */
status = pDev->MessagePendingCallback(pDev->HTCContext, &lookAhead, 1, pASyncProcessing, &fetched);
if (A_FAILED(status)) {
if (status) {
break;
}
if (!fetched) {
/* HTC could not pull any messages out due to lack of resources */
/* force DSR handler to ack the interrupt */
*pASyncProcessing = FALSE;
*pASyncProcessing = false;
pDev->RecheckIRQStatusCnt = 0;
}
}
@ -637,7 +637,7 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
if (HOST_INT_STATUS_CPU_GET(host_int_status)) {
/* CPU Interrupt */
status = DevServiceCPUInterrupt(pDev);
if (A_FAILED(status)){
if (status){
break;
}
}
@ -645,7 +645,7 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
if (HOST_INT_STATUS_ERROR_GET(host_int_status)) {
/* Error Interrupt */
status = DevServiceErrorInterrupt(pDev);
if (A_FAILED(status)){
if (status){
break;
}
}
@ -653,12 +653,12 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
if (HOST_INT_STATUS_COUNTER_GET(host_int_status)) {
/* Counter Interrupt */
status = DevServiceCounterInterrupt(pDev);
if (A_FAILED(status)){
if (status){
break;
}
}
} while (FALSE);
} while (false);
/* an optimization to bypass reading the IRQ status registers unecessarily which can re-wake
* the target, if upper layers determine that we are in a low-throughput mode, we can
@ -670,7 +670,7 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
* messages from the mailbox before exiting the ISR routine. */
if (!(*pASyncProcessing) && (pDev->RecheckIRQStatusCnt == 0) && (pDev->GetPendingEventsFunc == NULL)) {
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("Bypassing IRQ Status re-check, forcing done \n"));
*pDone = TRUE;
*pDone = true;
}
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-ProcessPendingIRQs: (done:%d, async:%d) status=%d \n",
@ -681,12 +681,12 @@ static A_STATUS ProcessPendingIRQs(AR6K_DEVICE *pDev, A_BOOL *pDone, A_BOOL *pAS
/* Synchronousinterrupt handler, this handler kicks off all interrupt processing.*/
A_STATUS DevDsrHandler(void *context)
int DevDsrHandler(void *context)
{
AR6K_DEVICE *pDev = (AR6K_DEVICE *)context;
A_STATUS status = A_OK;
A_BOOL done = FALSE;
A_BOOL asyncProc = FALSE;
struct ar6k_device *pDev = (struct ar6k_device *)context;
int status = 0;
bool done = false;
bool asyncProc = false;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevDsrHandler: (dev: 0x%lX)\n", (unsigned long)pDev));
@ -697,13 +697,13 @@ A_STATUS DevDsrHandler(void *context)
while (!done) {
status = ProcessPendingIRQs(pDev, &done, &asyncProc);
if (A_FAILED(status)) {
if (status) {
break;
}
if (HIF_DEVICE_IRQ_SYNC_ONLY == pDev->HifIRQProcessingMode) {
/* the HIF layer does not allow async IRQ processing, override the asyncProc flag */
asyncProc = FALSE;
asyncProc = false;
/* this will cause us to re-enter ProcessPendingIRQ() and re-read interrupt status registers.
* this has a nice side effect of blocking us until all async read requests are completed.
* This behavior is required on some HIF implementations that do not allow ASYNC
@ -725,7 +725,7 @@ A_STATUS DevDsrHandler(void *context)
}
if (A_SUCCESS(status) && !asyncProc) {
if (!status && !asyncProc) {
/* Ack the interrupt only if :
* 1. we did not get any errors in processing interrupts
* 2. there are no outstanding async processing requests */
@ -744,26 +744,26 @@ A_STATUS DevDsrHandler(void *context)
}
#ifdef ATH_DEBUG_MODULE
void DumpAR6KDevState(AR6K_DEVICE *pDev)
void DumpAR6KDevState(struct ar6k_device *pDev)
{
A_STATUS status;
AR6K_IRQ_ENABLE_REGISTERS regs;
AR6K_IRQ_PROC_REGISTERS procRegs;
int status;
struct ar6k_irq_enable_registers regs;
struct ar6k_irq_proc_registers procRegs;
LOCK_AR6K(pDev);
/* copy into our temp area */
A_MEMCPY(&regs,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
memcpy(&regs,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
UNLOCK_AR6K(pDev);
/* load the register table from the device */
status = HIFReadWrite(pDev->HIFDevice,
HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&procRegs,
(u8 *)&procRegs,
AR6K_IRQ_PROC_REGS_SIZE,
HIF_RD_SYNC_BYTE_INC,
NULL);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DumpAR6KDevState : Failed to read register table (%d) \n",status));
return;

View File

@ -54,18 +54,18 @@
/* external APIs for allocating and freeing internal I/O packets to handle ASYNC I/O */
extern void AR6KFreeIOPacket(AR6K_DEVICE *pDev, HTC_PACKET *pPacket);
extern HTC_PACKET *AR6KAllocIOPacket(AR6K_DEVICE *pDev);
extern void AR6KFreeIOPacket(struct ar6k_device *pDev, struct htc_packet *pPacket);
extern struct htc_packet *AR6KAllocIOPacket(struct ar6k_device *pDev);
/* callback when our fetch to enable/disable completes */
static void DevGMboxIRQActionAsyncHandler(void *Context, HTC_PACKET *pPacket)
static void DevGMboxIRQActionAsyncHandler(void *Context, struct htc_packet *pPacket)
{
AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context;
struct ar6k_device *pDev = (struct ar6k_device *)Context;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxIRQActionAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev));
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("IRQAction Operation (%d) failed! status:%d \n", pPacket->PktInfo.AsRx.HTCRxFlags,pPacket->Status));
}
@ -74,26 +74,26 @@ static void DevGMboxIRQActionAsyncHandler(void *Context, HTC_PACKET *pPacket)
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxIRQActionAsyncHandler \n"));
}
static A_STATUS DevGMboxCounterEnableDisable(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A_BOOL AsyncMode)
static int DevGMboxCounterEnableDisable(struct ar6k_device *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, bool AsyncMode)
{
A_STATUS status = A_OK;
AR6K_IRQ_ENABLE_REGISTERS regs;
HTC_PACKET *pIOPacket = NULL;
int status = 0;
struct ar6k_irq_enable_registers regs;
struct htc_packet *pIOPacket = NULL;
LOCK_AR6K(pDev);
if (GMBOX_CREDIT_IRQ_ENABLE == IrqAction) {
pDev->GMboxInfo.CreditCountIRQEnabled = TRUE;
pDev->GMboxInfo.CreditCountIRQEnabled = true;
pDev->IrqEnableRegisters.counter_int_status_enable |=
COUNTER_INT_STATUS_ENABLE_BIT_SET(1 << AR6K_GMBOX_CREDIT_COUNTER);
pDev->IrqEnableRegisters.int_status_enable |= INT_STATUS_ENABLE_COUNTER_SET(0x01);
} else {
pDev->GMboxInfo.CreditCountIRQEnabled = FALSE;
pDev->GMboxInfo.CreditCountIRQEnabled = false;
pDev->IrqEnableRegisters.counter_int_status_enable &=
~(COUNTER_INT_STATUS_ENABLE_BIT_SET(1 << AR6K_GMBOX_CREDIT_COUNTER));
}
/* copy into our temp area */
A_MEMCPY(&regs,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
memcpy(&regs,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
UNLOCK_AR6K(pDev);
@ -105,12 +105,12 @@ static A_STATUS DevGMboxCounterEnableDisable(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION
if (NULL == pIOPacket) {
status = A_NO_MEMORY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
/* copy values to write to our async I/O buffer */
A_MEMCPY(pIOPacket->pBuffer,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
memcpy(pIOPacket->pBuffer,&pDev->IrqEnableRegisters,AR6K_IRQ_ENABLE_REGS_SIZE);
/* stick in our completion routine when the I/O operation completes */
pIOPacket->Completion = DevGMboxIRQActionAsyncHandler;
@ -135,9 +135,9 @@ static A_STATUS DevGMboxCounterEnableDisable(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION
AR6K_IRQ_ENABLE_REGS_SIZE,
HIF_WR_SYNC_BYTE_INC,
NULL);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" IRQAction Operation (%d) failed! status:%d \n", IrqAction, status));
} else {
@ -155,11 +155,11 @@ static A_STATUS DevGMboxCounterEnableDisable(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION
}
A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A_BOOL AsyncMode)
int DevGMboxIRQAction(struct ar6k_device *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, bool AsyncMode)
{
A_STATUS status = A_OK;
HTC_PACKET *pIOPacket = NULL;
A_UINT8 GMboxIntControl[4];
int status = 0;
struct htc_packet *pIOPacket = NULL;
u8 GMboxIntControl[4];
if (GMBOX_CREDIT_IRQ_ENABLE == IrqAction) {
return DevGMboxCounterEnableDisable(pDev, GMBOX_CREDIT_IRQ_ENABLE, AsyncMode);
@ -192,7 +192,7 @@ A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A
break;
case GMBOX_ACTION_NONE:
default:
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -211,12 +211,12 @@ A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A
if (NULL == pIOPacket) {
status = A_NO_MEMORY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
/* copy values to write to our async I/O buffer */
A_MEMCPY(pIOPacket->pBuffer,GMboxIntControl,sizeof(GMboxIntControl));
memcpy(pIOPacket->pBuffer,GMboxIntControl,sizeof(GMboxIntControl));
/* stick in our completion routine when the I/O operation completes */
pIOPacket->Completion = DevGMboxIRQActionAsyncHandler;
@ -242,9 +242,9 @@ A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A
HIF_WR_SYNC_BYTE_FIX,
NULL);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" IRQAction Operation (%d) failed! status:%d \n", IrqAction, status));
} else {
@ -261,18 +261,18 @@ A_STATUS DevGMboxIRQAction(AR6K_DEVICE *pDev, GMBOX_IRQ_ACTION_TYPE IrqAction, A
return status;
}
void DevCleanupGMbox(AR6K_DEVICE *pDev)
void DevCleanupGMbox(struct ar6k_device *pDev)
{
if (pDev->GMboxEnabled) {
pDev->GMboxEnabled = FALSE;
pDev->GMboxEnabled = false;
GMboxProtocolUninstall(pDev);
}
}
A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev)
int DevSetupGMbox(struct ar6k_device *pDev)
{
A_STATUS status = A_OK;
A_UINT8 muxControl[4];
int status = 0;
u8 muxControl[4];
do {
@ -285,7 +285,7 @@ A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev)
status = DevGMboxIRQAction(pDev, GMBOX_DISABLE_ALL, PROC_IO_SYNC);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -305,29 +305,29 @@ A_STATUS DevSetupGMbox(AR6K_DEVICE *pDev)
HIF_WR_SYNC_BYTE_FIX, /* hit this register 4 times */
NULL);
if (A_FAILED(status)) {
if (status) {
break;
}
status = GMboxProtocolInstall(pDev);
if (A_FAILED(status)) {
if (status) {
break;
}
pDev->GMboxEnabled = TRUE;
pDev->GMboxEnabled = true;
} while (FALSE);
} while (false);
return status;
}
A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
int DevCheckGMboxInterrupts(struct ar6k_device *pDev)
{
A_STATUS status = A_OK;
A_UINT8 counter_int_status;
int status = 0;
u8 counter_int_status;
int credits;
A_UINT8 host_int_status2;
u8 host_int_status2;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("+DevCheckGMboxInterrupts \n"));
@ -348,7 +348,7 @@ A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
status = A_ECOMM;
}
if (A_FAILED(status)) {
if (status) {
if (pDev->GMboxInfo.pTargetFailureCallback != NULL) {
pDev->GMboxInfo.pTargetFailureCallback(pDev->GMboxInfo.pProtocolContext, status);
}
@ -360,12 +360,12 @@ A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
A_ASSERT(pDev->GMboxInfo.pMessagePendingCallBack != NULL);
status = pDev->GMboxInfo.pMessagePendingCallBack(
pDev->GMboxInfo.pProtocolContext,
(A_UINT8 *)&pDev->IrqProcRegisters.rx_gmbox_lookahead_alias[0],
(u8 *)&pDev->IrqProcRegisters.rx_gmbox_lookahead_alias[0],
pDev->IrqProcRegisters.gmbox_rx_avail);
}
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -378,7 +378,7 @@ A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
/* do synchronous read */
status = DevGMboxReadCreditCounter(pDev, PROC_IO_SYNC, &credits);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -388,7 +388,7 @@ A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
pDev->GMboxInfo.CreditCountIRQEnabled);
}
} while (FALSE);
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevCheckGMboxInterrupts (%d) \n",status));
@ -396,12 +396,12 @@ A_STATUS DevCheckGMboxInterrupts(AR6K_DEVICE *pDev)
}
A_STATUS DevGMboxWrite(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 WriteLength)
int DevGMboxWrite(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 WriteLength)
{
A_UINT32 paddedLength;
A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE;
A_STATUS status;
A_UINT32 address;
u32 paddedLength;
bool sync = (pPacket->Completion == NULL) ? true : false;
int status;
u32 address;
/* adjust the length to be a multiple of block size if appropriate */
paddedLength = DEV_CALC_SEND_PADDED_LEN(pDev, WriteLength);
@ -426,31 +426,31 @@ A_STATUS DevGMboxWrite(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 WriteLen
pPacket->Status = status;
} else {
if (status == A_PENDING) {
status = A_OK;
status = 0;
}
}
return status;
}
A_STATUS DevGMboxRead(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ReadLength)
int DevGMboxRead(struct ar6k_device *pDev, struct htc_packet *pPacket, u32 ReadLength)
{
A_UINT32 paddedLength;
A_STATUS status;
A_BOOL sync = (pPacket->Completion == NULL) ? TRUE : FALSE;
u32 paddedLength;
int status;
bool sync = (pPacket->Completion == NULL) ? true : false;
/* adjust the length to be a multiple of block size if appropriate */
paddedLength = DEV_CALC_RECV_PADDED_LEN(pDev, ReadLength);
if (paddedLength > pPacket->BufferLength) {
A_ASSERT(FALSE);
A_ASSERT(false);
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DevGMboxRead, Not enough space for padlen:%d recvlen:%d bufferlen:%d \n",
paddedLength,ReadLength,pPacket->BufferLength));
if (pPacket->Completion != NULL) {
COMPLETE_HTC_PACKET(pPacket,A_EINVAL);
return A_OK;
return 0;
}
return A_EINVAL;
}
@ -477,7 +477,7 @@ A_STATUS DevGMboxRead(AR6K_DEVICE *pDev, HTC_PACKET *pPacket, A_UINT32 ReadLengt
}
static int ProcessCreditCounterReadBuffer(A_UINT8 *pBuffer, int Length)
static int ProcessCreditCounterReadBuffer(u8 *pBuffer, int Length)
{
int credits = 0;
@ -516,13 +516,13 @@ static int ProcessCreditCounterReadBuffer(A_UINT8 *pBuffer, int Length)
/* callback when our fetch to enable/disable completes */
static void DevGMboxReadCreditsAsyncHandler(void *Context, HTC_PACKET *pPacket)
static void DevGMboxReadCreditsAsyncHandler(void *Context, struct htc_packet *pPacket)
{
AR6K_DEVICE *pDev = (AR6K_DEVICE *)Context;
struct ar6k_device *pDev = (struct ar6k_device *)Context;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("+DevGMboxReadCreditsAsyncHandler: (dev: 0x%lX)\n", (unsigned long)pDev));
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Read Credit Operation failed! status:%d \n", pPacket->Status));
} else {
@ -539,10 +539,10 @@ static void DevGMboxReadCreditsAsyncHandler(void *Context, HTC_PACKET *pPacket)
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,("-DevGMboxReadCreditsAsyncHandler \n"));
}
A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCredits)
int DevGMboxReadCreditCounter(struct ar6k_device *pDev, bool AsyncMode, int *pCredits)
{
A_STATUS status = A_OK;
HTC_PACKET *pIOPacket = NULL;
int status = 0;
struct htc_packet *pIOPacket = NULL;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+DevGMboxReadCreditCounter (%s) \n", AsyncMode ? "ASYNC" : "SYNC"));
@ -552,7 +552,7 @@ A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCr
if (NULL == pIOPacket) {
status = A_NO_MEMORY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -581,15 +581,15 @@ A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCr
AR6K_REG_IO_BUFFER_SIZE,
HIF_RD_SYNC_BYTE_FIX,
NULL);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" DevGMboxReadCreditCounter failed! status:%d \n", status));
}
if (pIOPacket != NULL) {
if (A_SUCCESS(status)) {
if (!status) {
/* sync mode processing */
*pCredits = ProcessCreditCounterReadBuffer(pIOPacket->pBuffer, AR6K_REG_IO_BUFFER_SIZE);
}
@ -602,10 +602,10 @@ A_STATUS DevGMboxReadCreditCounter(AR6K_DEVICE *pDev, A_BOOL AsyncMode, int *pCr
return status;
}
A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize)
int DevGMboxReadCreditSize(struct ar6k_device *pDev, int *pCreditSize)
{
A_STATUS status;
A_UINT8 buffer[4];
int status;
u8 buffer[4];
status = HIFReadWrite(pDev->HIFDevice,
AR6K_GMBOX_CREDIT_SIZE_ADDRESS,
@ -614,7 +614,7 @@ A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize)
HIF_RD_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */
NULL);
if (A_SUCCESS(status)) {
if (!status) {
if (buffer[0] == 0) {
*pCreditSize = 256;
} else {
@ -626,7 +626,7 @@ A_STATUS DevGMboxReadCreditSize(AR6K_DEVICE *pDev, int *pCreditSize)
return status;
}
void DevNotifyGMboxTargetFailure(AR6K_DEVICE *pDev)
void DevNotifyGMboxTargetFailure(struct ar6k_device *pDev)
{
/* Target ASSERTED!!! */
if (pDev->GMboxInfo.pTargetFailureCallback != NULL) {
@ -634,17 +634,17 @@ void DevNotifyGMboxTargetFailure(AR6K_DEVICE *pDev)
}
}
A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer, int *pLookAheadBytes)
int DevGMboxRecvLookAheadPeek(struct ar6k_device *pDev, u8 *pLookAheadBuffer, int *pLookAheadBytes)
{
A_STATUS status = A_OK;
AR6K_IRQ_PROC_REGISTERS procRegs;
int status = 0;
struct ar6k_irq_proc_registers procRegs;
int maxCopy;
do {
/* on entry the caller provides the length of the lookahead buffer */
if (*pLookAheadBytes > sizeof(procRegs.rx_gmbox_lookahead_alias)) {
A_ASSERT(FALSE);
A_ASSERT(false);
status = A_EINVAL;
break;
}
@ -654,12 +654,12 @@ A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer,
/* load the register table from the device */
status = HIFReadWrite(pDev->HIFDevice,
HOST_INT_STATUS_ADDRESS,
(A_UINT8 *)&procRegs,
(u8 *)&procRegs,
AR6K_IRQ_PROC_REGS_SIZE,
HIF_RD_SYNC_BYTE_INC,
NULL);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DevGMboxRecvLookAheadPeek : Failed to read register table (%d) \n",status));
break;
@ -667,20 +667,20 @@ A_STATUS DevGMboxRecvLookAheadPeek(AR6K_DEVICE *pDev, A_UINT8 *pLookAheadBuffer,
if (procRegs.gmbox_rx_avail > 0) {
int bytes = procRegs.gmbox_rx_avail > maxCopy ? maxCopy : procRegs.gmbox_rx_avail;
A_MEMCPY(pLookAheadBuffer,&procRegs.rx_gmbox_lookahead_alias[0],bytes);
memcpy(pLookAheadBuffer,&procRegs.rx_gmbox_lookahead_alias[0],bytes);
*pLookAheadBytes = bytes;
}
} while (FALSE);
} while (false);
return status;
}
A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeoutMS)
int DevGMboxSetTargetInterrupt(struct ar6k_device *pDev, int Signal, int AckTimeoutMS)
{
A_STATUS status = A_OK;
int status = 0;
int i;
A_UINT8 buffer[4];
u8 buffer[4];
A_MEMZERO(buffer, sizeof(buffer));
@ -701,14 +701,14 @@ A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeou
HIF_WR_SYNC_BYTE_FIX, /* hit the register 4 times to align the I/O */
NULL);
if (A_FAILED(status)) {
if (status) {
break;
}
} while (FALSE);
} while (false);
if (A_SUCCESS(status)) {
if (!status) {
/* now read back the register to see if the bit cleared */
while (AckTimeoutMS) {
status = HIFReadWrite(pDev->HIFDevice,
@ -718,7 +718,7 @@ A_STATUS DevGMboxSetTargetInterrupt(AR6K_DEVICE *pDev, int Signal, int AckTimeou
HIF_RD_SYNC_BYTE_FIX,
NULL);
if (A_FAILED(status)) {
if (status) {
break;
}

View File

@ -56,17 +56,17 @@
#define BAUD_TIMEOUT_MS 1
#define BTPWRSAV_TIMEOUT_MS 1
typedef struct {
HCI_TRANSPORT_CONFIG_INFO HCIConfig;
A_BOOL HCIAttached;
A_BOOL HCIStopped;
A_UINT32 RecvStateFlags;
A_UINT32 SendStateFlags;
struct gmbox_proto_hci_uart {
struct hci_transport_config_info HCIConfig;
bool HCIAttached;
bool HCIStopped;
u32 RecvStateFlags;
u32 SendStateFlags;
HCI_TRANSPORT_PACKET_TYPE WaitBufferType;
HTC_PACKET_QUEUE SendQueue; /* write queue holding HCI Command and ACL packets */
HTC_PACKET_QUEUE HCIACLRecvBuffers; /* recv queue holding buffers for incomming ACL packets */
HTC_PACKET_QUEUE HCIEventBuffers; /* recv queue holding buffers for incomming event packets */
AR6K_DEVICE *pDev;
struct htc_packet_queue SendQueue; /* write queue holding HCI Command and ACL packets */
struct htc_packet_queue HCIACLRecvBuffers; /* recv queue holding buffers for incomming ACL packets */
struct htc_packet_queue HCIEventBuffers; /* recv queue holding buffers for incomming event packets */
struct ar6k_device *pDev;
A_MUTEX_T HCIRxLock;
A_MUTEX_T HCITxLock;
int CreditsMax;
@ -75,18 +75,23 @@ typedef struct {
int CreditSize;
int CreditsCurrentSeek;
int SendProcessCount;
} GMBOX_PROTO_HCI_UART;
};
#define LOCK_HCI_RX(t) A_MUTEX_LOCK(&(t)->HCIRxLock);
#define UNLOCK_HCI_RX(t) A_MUTEX_UNLOCK(&(t)->HCIRxLock);
#define LOCK_HCI_TX(t) A_MUTEX_LOCK(&(t)->HCITxLock);
#define UNLOCK_HCI_TX(t) A_MUTEX_UNLOCK(&(t)->HCITxLock);
#define DO_HCI_RECV_INDICATION(p,pt) \
{ AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \
(unsigned long)(pt),(pt)->Status, A_SUCCESS((pt)->Status) ? (pt)->ActualLength : 0, HCI_GET_PACKET_TYPE(pt))); \
(p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \
}
#define DO_HCI_RECV_INDICATION(p, pt) \
do { \
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, \
("HCI: Indicate Recv on packet:0x%lX status:%d len:%d type:%d \n", \
(unsigned long)(pt), \
(pt)->Status, \
!(pt)->Status ? (pt)->ActualLength : 0, \
HCI_GET_PACKET_TYPE(pt))); \
(p)->HCIConfig.pHCIPktRecv((p)->HCIConfig.pContext, (pt)); \
} while (0)
#define DO_HCI_SEND_INDICATION(p,pt) \
{ AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("HCI: Indicate Send on packet:0x%lX status:%d type:%d \n", \
@ -94,9 +99,9 @@ typedef struct {
(p)->HCIConfig.pHCISendComplete((p)->HCIConfig.pContext, (pt)); \
}
static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL Synchronous);
static int HCITrySend(struct gmbox_proto_hci_uart *pProt, struct htc_packet *pPacket, bool Synchronous);
static void HCIUartCleanup(GMBOX_PROTO_HCI_UART *pProtocol)
static void HCIUartCleanup(struct gmbox_proto_hci_uart *pProtocol)
{
A_ASSERT(pProtocol != NULL);
@ -106,12 +111,12 @@ static void HCIUartCleanup(GMBOX_PROTO_HCI_UART *pProtocol)
A_FREE(pProtocol);
}
static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
static int InitTxCreditState(struct gmbox_proto_hci_uart *pProt)
{
A_STATUS status;
int status;
int credits;
int creditPollCount = CREDIT_POLL_COUNT;
A_BOOL gotCredits = FALSE;
bool gotCredits = false;
pProt->CreditsConsumed = 0;
@ -120,7 +125,7 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
if (pProt->CreditsMax != 0) {
/* we can only call this only once per target reset */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI: InitTxCreditState - already called! \n"));
A_ASSERT(FALSE);
A_ASSERT(false);
status = A_EINVAL;
break;
}
@ -135,7 +140,7 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
status = DevGMboxReadCreditCounter(pProt->pDev, PROC_IO_SYNC, &credits);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -145,7 +150,7 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
A_MDELAY(HCI_DELAY_PER_INTERVAL_MS);
continue;
} else {
gotCredits = TRUE;
gotCredits = true;
}
if (0 == credits) {
@ -155,7 +160,7 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
pProt->CreditsMax += credits;
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -169,13 +174,13 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
/* now get the size */
status = DevGMboxReadCreditSize(pProt->pDev, &pProt->CreditSize);
if (A_FAILED(status)) {
if (status) {
break;
}
} while (FALSE);
} while (false);
if (A_SUCCESS(status)) {
if (!status) {
pProt->CreditsAvailable = pProt->CreditsMax;
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("HCI : InitTxCreditState - credits avail: %d, size: %d \n",
pProt->CreditsAvailable, pProt->CreditSize));
@ -184,13 +189,13 @@ static A_STATUS InitTxCreditState(GMBOX_PROTO_HCI_UART *pProt)
return status;
}
static A_STATUS CreditsAvailableCallback(void *pContext, int Credits, A_BOOL CreditIRQEnabled)
static int CreditsAvailableCallback(void *pContext, int Credits, bool CreditIRQEnabled)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
A_BOOL enableCreditIrq = FALSE;
A_BOOL disableCreditIrq = FALSE;
A_BOOL doPendingSends = FALSE;
A_STATUS status = A_OK;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
bool enableCreditIrq = false;
bool disableCreditIrq = false;
bool doPendingSends = false;
int status = 0;
/** this callback is called under 2 conditions:
* 1. The credit IRQ interrupt was enabled and signaled.
@ -209,7 +214,7 @@ static A_STATUS CreditsAvailableCallback(void *pContext, int Credits, A_BOOL Cre
if (0 == Credits) {
if (!CreditIRQEnabled) {
/* enable credit IRQ */
enableCreditIrq = TRUE;
enableCreditIrq = true;
}
break;
}
@ -235,19 +240,19 @@ static A_STATUS CreditsAvailableCallback(void *pContext, int Credits, A_BOOL Cre
/* we have enough credits to fullfill at least 1 packet waiting in the queue */
pProt->CreditsCurrentSeek = 0;
pProt->SendStateFlags &= ~HCI_SEND_WAIT_CREDITS;
doPendingSends = TRUE;
doPendingSends = true;
if (CreditIRQEnabled) {
/* credit IRQ was enabled, we shouldn't need it anymore */
disableCreditIrq = TRUE;
disableCreditIrq = true;
}
} else {
/* not enough credits yet, enable credit IRQ if we haven't already */
if (!CreditIRQEnabled) {
enableCreditIrq = TRUE;
enableCreditIrq = true;
}
}
} while (FALSE);
} while (false);
UNLOCK_HCI_TX(pProt);
@ -262,23 +267,23 @@ static A_STATUS CreditsAvailableCallback(void *pContext, int Credits, A_BOOL Cre
}
if (doPendingSends) {
HCITrySend(pProt, NULL, FALSE);
HCITrySend(pProt, NULL, false);
}
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+CreditsAvailableCallback \n"));
return status;
}
static INLINE void NotifyTransportFailure(GMBOX_PROTO_HCI_UART *pProt, A_STATUS status)
static INLINE void NotifyTransportFailure(struct gmbox_proto_hci_uart *pProt, int status)
{
if (pProt->HCIConfig.TransportFailure != NULL) {
pProt->HCIConfig.TransportFailure(pProt->HCIConfig.pContext, status);
}
}
static void FailureCallback(void *pContext, A_STATUS Status)
static void FailureCallback(void *pContext, int Status)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
/* target assertion occured */
NotifyTransportFailure(pProt, Status);
@ -286,7 +291,7 @@ static void FailureCallback(void *pContext, A_STATUS Status)
static void StateDumpCallback(void *pContext)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("============ HCIUart State ======================\n"));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("RecvStateFlags : 0x%X \n",pProt->RecvStateFlags));
@ -299,15 +304,15 @@ static void StateDumpCallback(void *pContext)
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,("==================================================\n"));
}
static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[], int ValidBytes)
static int HCIUartMessagePending(void *pContext, u8 LookAheadBytes[], int ValidBytes)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)pContext;
A_STATUS status = A_OK;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)pContext;
int status = 0;
int totalRecvLength = 0;
HCI_TRANSPORT_PACKET_TYPE pktType = HCI_PACKET_INVALID;
A_BOOL recvRefillCalled = FALSE;
A_BOOL blockRecv = FALSE;
HTC_PACKET *pPacket = NULL;
bool recvRefillCalled = false;
bool blockRecv = false;
struct htc_packet *pPacket = NULL;
/** caller guarantees that this is a fully block-able context (synch I/O is allowed) */
@ -348,7 +353,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
break;
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -361,7 +366,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
LOCK_HCI_RX(pProt);
} else {
HTC_PACKET_QUEUE *pQueue;
struct htc_packet_queue *pQueue;
/* user is using a refill handler that can refill multiple HTC buffers */
/* select buffer queue */
@ -377,7 +382,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
pktType));
/* check for refill handler */
if (pProt->HCIConfig.pHCIPktRecvRefill != NULL) {
recvRefillCalled = TRUE;
recvRefillCalled = true;
UNLOCK_HCI_RX(pProt);
/* call the re-fill handler */
pProt->HCIConfig.pHCIPktRecvRefill(pProt->HCIConfig.pContext,
@ -402,7 +407,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
/* this is not an error, we simply need to mark that we are waiting for buffers.*/
pProt->RecvStateFlags |= HCI_RECV_WAIT_BUFFERS;
pProt->WaitBufferType = pktType;
blockRecv = TRUE;
blockRecv = true;
break;
}
@ -413,7 +418,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
break;
}
} while (FALSE);
} while (false);
UNLOCK_HCI_RX(pProt);
@ -421,7 +426,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
do {
if (A_FAILED(status) || (NULL == pPacket)) {
if (status || (NULL == pPacket)) {
break;
}
@ -433,7 +438,7 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
status = DevGMboxRead(pProt->pDev, pPacket, totalRecvLength);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -471,14 +476,14 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
/* adjust buffer to move past packet ID */
pPacket->pBuffer++;
pPacket->ActualLength = totalRecvLength - 1;
pPacket->Status = A_OK;
pPacket->Status = 0;
/* indicate packet */
DO_HCI_RECV_INDICATION(pProt,pPacket);
pPacket = NULL;
/* check if we need to refill recv buffers */
if ((pProt->HCIConfig.pHCIPktRecvRefill != NULL) && !recvRefillCalled) {
HTC_PACKET_QUEUE *pQueue;
struct htc_packet_queue *pQueue;
int watermark;
if (pktType == HCI_ACL_TYPE) {
@ -500,16 +505,16 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
}
}
} while (FALSE);
} while (false);
/* check if we need to disable the reciever */
if (A_FAILED(status) || blockRecv) {
if (status || blockRecv) {
DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_DISABLE, PROC_IO_SYNC);
}
/* see if we need to recycle the recv buffer */
if (A_FAILED(status) && (pPacket != NULL)) {
HTC_PACKET_QUEUE queue;
if (status && (pPacket != NULL)) {
struct htc_packet_queue queue;
if (A_EPROTO == status) {
DebugDumpBytes(pPacket->pBuffer, totalRecvLength, "Bad HCI-UART Recv packet");
@ -527,12 +532,12 @@ static A_STATUS HCIUartMessagePending(void *pContext, A_UINT8 LookAheadBytes[],
return status;
}
static void HCISendPacketCompletion(void *Context, HTC_PACKET *pPacket)
static void HCISendPacketCompletion(void *Context, struct htc_packet *pPacket)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)Context;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)Context;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion (pPacket:0x%lX) \n",(unsigned long)pPacket));
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" Send Packet (0x%lX) failed: %d , len:%d \n",
(unsigned long)pPacket, pPacket->Status, pPacket->ActualLength));
}
@ -542,16 +547,16 @@ static void HCISendPacketCompletion(void *Context, HTC_PACKET *pPacket)
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCISendPacketCompletion \n"));
}
static A_STATUS SeekCreditsSynch(GMBOX_PROTO_HCI_UART *pProt)
static int SeekCreditsSynch(struct gmbox_proto_hci_uart *pProt)
{
A_STATUS status = A_OK;
int status = 0;
int credits;
int retry = 100;
while (TRUE) {
while (true) {
credits = 0;
status = DevGMboxReadCreditCounter(pProt->pDev, PROC_IO_SYNC, &credits);
if (A_FAILED(status)) {
if (status) {
break;
}
LOCK_HCI_TX(pProt);
@ -574,13 +579,13 @@ static A_STATUS SeekCreditsSynch(GMBOX_PROTO_HCI_UART *pProt)
return status;
}
static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_BOOL Synchronous)
static int HCITrySend(struct gmbox_proto_hci_uart *pProt, struct htc_packet *pPacket, bool Synchronous)
{
A_STATUS status = A_OK;
int status = 0;
int transferLength;
int creditsRequired, remainder;
A_UINT8 hciUartType;
A_BOOL synchSendComplete = FALSE;
u8 hciUartType;
bool synchSendComplete = false;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+HCITrySend (pPacket:0x%lX) %s \n",(unsigned long)pPacket,
Synchronous ? "SYNC" :"ASYNC"));
@ -603,14 +608,14 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
/* in synchronous mode, the send queue can only hold 1 packet */
if (!HTC_QUEUE_EMPTY(&pProt->SendQueue)) {
status = A_EBUSY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
if (pProt->SendProcessCount > 1) {
/* another thread or task is draining the TX queues */
status = A_EBUSY;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -667,11 +672,11 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
break;
default:
status = A_EINVAL;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -701,7 +706,7 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
UNLOCK_HCI_TX(pProt);
status = SeekCreditsSynch(pProt);
LOCK_HCI_TX(pProt);
if (A_FAILED(status)) {
if (status) {
break;
}
/* fall through and continue processing this send op */
@ -751,7 +756,7 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
status = DevGMboxWrite(pProt->pDev,pPacket,transferLength);
if (Synchronous) {
synchSendComplete = TRUE;
synchSendComplete = true;
} else {
pPacket = NULL;
}
@ -760,7 +765,7 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
}
} while (FALSE);
} while (false);
pProt->SendProcessCount--;
A_ASSERT(pProt->SendProcessCount >= 0);
@ -768,9 +773,9 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
if (Synchronous) {
A_ASSERT(pPacket != NULL);
if (A_SUCCESS(status) && (!synchSendComplete)) {
if (!status && (!synchSendComplete)) {
status = A_EBUSY;
A_ASSERT(FALSE);
A_ASSERT(false);
LOCK_HCI_TX(pProt);
if (pPacket->ListLink.pNext != NULL) {
/* remove from the queue */
@ -779,7 +784,7 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
UNLOCK_HCI_TX(pProt);
}
} else {
if (A_FAILED(status) && (pPacket != NULL)) {
if (status && (pPacket != NULL)) {
pPacket->Status = status;
DO_HCI_SEND_INDICATION(pProt,pPacket);
}
@ -789,10 +794,10 @@ static A_STATUS HCITrySend(GMBOX_PROTO_HCI_UART *pProt, HTC_PACKET *pPacket, A_B
return status;
}
static void FlushSendQueue(GMBOX_PROTO_HCI_UART *pProt)
static void FlushSendQueue(struct gmbox_proto_hci_uart *pProt)
{
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE discardQueue;
struct htc_packet *pPacket;
struct htc_packet_queue discardQueue;
INIT_HTC_PACKET_QUEUE(&discardQueue);
@ -813,10 +818,10 @@ static void FlushSendQueue(GMBOX_PROTO_HCI_UART *pProt)
}
static void FlushRecvBuffers(GMBOX_PROTO_HCI_UART *pProt)
static void FlushRecvBuffers(struct gmbox_proto_hci_uart *pProt)
{
HTC_PACKET_QUEUE discardQueue;
HTC_PACKET *pPacket;
struct htc_packet_queue discardQueue;
struct htc_packet *pPacket;
INIT_HTC_PACKET_QUEUE(&discardQueue);
@ -841,14 +846,14 @@ static void FlushRecvBuffers(GMBOX_PROTO_HCI_UART *pProt)
/*** protocol module install entry point ***/
A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev)
int GMboxProtocolInstall(struct ar6k_device *pDev)
{
A_STATUS status = A_OK;
GMBOX_PROTO_HCI_UART *pProtocol = NULL;
int status = 0;
struct gmbox_proto_hci_uart *pProtocol = NULL;
do {
pProtocol = A_MALLOC(sizeof(GMBOX_PROTO_HCI_UART));
pProtocol = A_MALLOC(sizeof(struct gmbox_proto_hci_uart));
if (NULL == pProtocol) {
status = A_NO_MEMORY;
@ -863,9 +868,9 @@ A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev)
A_MUTEX_INIT(&pProtocol->HCIRxLock);
A_MUTEX_INIT(&pProtocol->HCITxLock);
} while (FALSE);
} while (false);
if (A_SUCCESS(status)) {
if (!status) {
LOCK_AR6K(pDev);
DEV_GMBOX_SET_PROTOCOL(pDev,
HCIUartMessagePending,
@ -884,9 +889,9 @@ A_STATUS GMboxProtocolInstall(AR6K_DEVICE *pDev)
}
/*** protocol module uninstall entry point ***/
void GMboxProtocolUninstall(AR6K_DEVICE *pDev)
void GMboxProtocolUninstall(struct ar6k_device *pDev)
{
GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev);
struct gmbox_proto_hci_uart *pProtocol = (struct gmbox_proto_hci_uart *)DEV_GMBOX_GET_PROTOCOL(pDev);
if (pProtocol != NULL) {
@ -894,7 +899,7 @@ void GMboxProtocolUninstall(AR6K_DEVICE *pDev)
if (pProtocol->HCIAttached) {
A_ASSERT(pProtocol->HCIConfig.TransportRemoved != NULL);
pProtocol->HCIConfig.TransportRemoved(pProtocol->HCIConfig.pContext);
pProtocol->HCIAttached = FALSE;
pProtocol->HCIAttached = false;
}
HCIUartCleanup(pProtocol);
@ -903,10 +908,10 @@ void GMboxProtocolUninstall(AR6K_DEVICE *pDev)
}
static A_STATUS NotifyTransportReady(GMBOX_PROTO_HCI_UART *pProt)
static int NotifyTransportReady(struct gmbox_proto_hci_uart *pProt)
{
HCI_TRANSPORT_PROPERTIES props;
A_STATUS status = A_OK;
struct hci_transport_properties props;
int status = 0;
do {
@ -924,17 +929,17 @@ static A_STATUS NotifyTransportReady(GMBOX_PROTO_HCI_UART *pProt)
pProt->HCIConfig.pContext);
}
} while (FALSE);
} while (false);
return status;
}
/*********** HCI UART protocol implementation ************************************************/
HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo)
HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, struct hci_transport_config_info *pInfo)
{
GMBOX_PROTO_HCI_UART *pProtocol = NULL;
AR6K_DEVICE *pDev;
struct gmbox_proto_hci_uart *pProtocol = NULL;
struct ar6k_device *pDev;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportAttach \n"));
@ -944,7 +949,7 @@ HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_I
do {
pProtocol = (GMBOX_PROTO_HCI_UART *)DEV_GMBOX_GET_PROTOCOL(pDev);
pProtocol = (struct gmbox_proto_hci_uart *)DEV_GMBOX_GET_PROTOCOL(pDev);
if (NULL == pProtocol) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("GMBOX protocol not installed! \n"));
@ -956,14 +961,14 @@ HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_I
break;
}
A_MEMCPY(&pProtocol->HCIConfig, pInfo, sizeof(HCI_TRANSPORT_CONFIG_INFO));
memcpy(&pProtocol->HCIConfig, pInfo, sizeof(struct hci_transport_config_info));
A_ASSERT(pProtocol->HCIConfig.pHCIPktRecv != NULL);
A_ASSERT(pProtocol->HCIConfig.pHCISendComplete != NULL);
pProtocol->HCIAttached = TRUE;
pProtocol->HCIAttached = true;
} while (FALSE);
} while (false);
UNLOCK_AR6K(pDev);
@ -978,8 +983,8 @@ HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_I
void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans)
{
GMBOX_PROTO_HCI_UART *pProtocol = (GMBOX_PROTO_HCI_UART *)HciTrans;
AR6K_DEVICE *pDev = pProtocol->pDev;
struct gmbox_proto_hci_uart *pProtocol = (struct gmbox_proto_hci_uart *)HciTrans;
struct ar6k_device *pDev = pProtocol->pDev;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportDetach \n"));
@ -989,19 +994,19 @@ void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans)
UNLOCK_AR6K(pDev);
return;
}
pProtocol->HCIAttached = FALSE;
pProtocol->HCIAttached = false;
UNLOCK_AR6K(pDev);
HCI_TransportStop(HciTrans);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportAttach \n"));
}
A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue)
int HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet_queue *pQueue)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
A_STATUS status = A_OK;
A_BOOL unblockRecv = FALSE;
HTC_PACKET *pPacket;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
int status = 0;
bool unblockRecv = false;
struct htc_packet *pPacket;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HCI_TransportAddReceivePkt \n"));
@ -1039,15 +1044,15 @@ A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_Q
pProt->WaitBufferType));
pProt->RecvStateFlags &= ~HCI_RECV_WAIT_BUFFERS;
pProt->WaitBufferType = HCI_PACKET_INVALID;
unblockRecv = TRUE;
unblockRecv = true;
}
}
} while (FALSE);
} while (false);
UNLOCK_HCI_RX(pProt);
if (A_FAILED(status)) {
if (status) {
while (!HTC_QUEUE_EMPTY(pQueue)) {
pPacket = HTC_PACKET_DEQUEUE(pQueue);
pPacket->Status = A_ECANCELED;
@ -1061,19 +1066,19 @@ A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_Q
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HCI_TransportAddReceivePkt \n"));
return A_OK;
return 0;
}
A_STATUS HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous)
int HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet *pPacket, bool Synchronous)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
return HCITrySend(pProt,pPacket,Synchronous);
}
void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStop \n"));
@ -1083,7 +1088,7 @@ void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans)
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStop \n"));
return;
}
pProt->HCIStopped = TRUE;
pProt->HCIStopped = true;
UNLOCK_AR6K(pProt->pDev);
/* disable interrupts */
@ -1097,69 +1102,69 @@ void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans)
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStop \n"));
}
A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans)
int HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans)
{
A_STATUS status;
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
int status;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("+HCI_TransportStart \n"));
/* set stopped in case we have a problem in starting */
pProt->HCIStopped = TRUE;
pProt->HCIStopped = true;
do {
status = InitTxCreditState(pProt);
if (A_FAILED(status)) {
if (status) {
break;
}
status = DevGMboxIRQAction(pProt->pDev, GMBOX_ERRORS_IRQ_ENABLE, PROC_IO_SYNC);
if (A_FAILED(status)) {
if (status) {
break;
}
/* enable recv */
status = DevGMboxIRQAction(pProt->pDev, GMBOX_RECV_IRQ_ENABLE, PROC_IO_SYNC);
if (A_FAILED(status)) {
if (status) {
break;
}
/* signal bridge side to power up BT */
status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_BT_ON, BTON_TIMEOUT_MS);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI_TransportStart : Failed to trigger BT ON \n"));
break;
}
/* we made it */
pProt->HCIStopped = FALSE;
pProt->HCIStopped = false;
} while (FALSE);
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC,("-HCI_TransportStart \n"));
return status;
}
A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable)
int HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, bool Enable)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
return DevGMboxIRQAction(pProt->pDev,
Enable ? GMBOX_RECV_IRQ_ENABLE : GMBOX_RECV_IRQ_DISABLE,
PROC_IO_SYNC);
}
A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
HTC_PACKET *pPacket,
int HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
struct htc_packet *pPacket,
int MaxPollMS)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
A_STATUS status = A_OK;
A_UINT8 lookAhead[8];
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
int status = 0;
u8 lookAhead[8];
int bytes;
int totalRecvLength;
@ -1173,7 +1178,7 @@ A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
bytes = sizeof(lookAhead);
status = DevGMboxRecvLookAheadPeek(pProt->pDev,lookAhead,&bytes);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -1199,19 +1204,19 @@ A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
break;
}
if (A_FAILED(status)) {
if (status) {
break;
}
pPacket->Completion = NULL;
status = DevGMboxRead(pProt->pDev,pPacket,totalRecvLength);
if (A_FAILED(status)) {
if (status) {
break;
}
pPacket->pBuffer++;
pPacket->ActualLength = totalRecvLength - 1;
pPacket->Status = A_OK;
pPacket->Status = 0;
break;
}
@ -1225,12 +1230,12 @@ A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
#define LSB_SCRATCH_IDX 4
#define MSB_SCRATCH_IDX 5
A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud)
int HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, u32 Baud)
{
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
HIF_DEVICE *pHIFDevice = (HIF_DEVICE *)(pProt->pDev->HIFDevice);
A_UINT32 scaledBaud, scratchAddr;
A_STATUS status = A_OK;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
struct hif_device *pHIFDevice = (struct hif_device *)(pProt->pDev->HIFDevice);
u32 scaledBaud, scratchAddr;
int status = 0;
/* Divide the desired baud rate by 100
* Store the LSB in the local scratch register 4 and the MSB in the local
@ -1242,24 +1247,24 @@ A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud)
scratchAddr = MBOX_BASE_ADDRESS | (LOCAL_SCRATCH_ADDRESS + 4 * MSB_SCRATCH_IDX);
scaledBaud = ((Baud / 100) >> (LOCAL_SCRATCH_VALUE_MSB+1)) & LOCAL_SCRATCH_VALUE_MASK;
status |= ar6000_WriteRegDiag(pHIFDevice, &scratchAddr, &scaledBaud);
if (A_OK != status) {
if (0 != status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to set up baud rate in scratch register!"));
return status;
}
/* Now interrupt the target to tell it about the baud rate */
status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_BAUD_SET, BAUD_TIMEOUT_MS);
if (A_OK != status) {
if (0 != status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to tell target to change baud rate!"));
}
return status;
}
A_STATUS HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable)
int HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, bool Enable)
{
A_STATUS status;
GMBOX_PROTO_HCI_UART *pProt = (GMBOX_PROTO_HCI_UART *)HciTrans;
int status;
struct gmbox_proto_hci_uart *pProt = (struct gmbox_proto_hci_uart *)HciTrans;
if (Enable) {
status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_PWR_SAV_ON, BTPWRSAV_TIMEOUT_MS);
@ -1267,7 +1272,7 @@ A_STATUS HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enab
status = DevGMboxSetTargetInterrupt(pProt->pDev, MBOX_SIG_HCI_BRIDGE_PWR_SAV_OFF, BTPWRSAV_TIMEOUT_MS);
}
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to enable/disable HCI power management!\n"));
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HCI power management enabled/disabled!\n"));

View File

@ -23,7 +23,7 @@
#include "htc_internal.h"
#ifdef ATH_DEBUG_MODULE
static ATH_DEBUG_MASK_DESCRIPTION g_HTCDebugDescription[] = {
static struct ath_debug_mask_description g_HTCDebugDescription[] = {
{ ATH_DEBUG_SEND , "Send"},
{ ATH_DEBUG_RECV , "Recv"},
{ ATH_DEBUG_SYNC , "Sync"},
@ -41,18 +41,18 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(htc,
#endif
static void HTCReportFailure(void *Context);
static void ResetEndpointStates(HTC_TARGET *target);
static void ResetEndpointStates(struct htc_target *target);
void HTCFreeControlBuffer(HTC_TARGET *target, HTC_PACKET *pPacket, HTC_PACKET_QUEUE *pList)
void HTCFreeControlBuffer(struct htc_target *target, struct htc_packet *pPacket, struct htc_packet_queue *pList)
{
LOCK_HTC(target);
HTC_PACKET_ENQUEUE(pList,pPacket);
UNLOCK_HTC(target);
}
HTC_PACKET *HTCAllocControlBuffer(HTC_TARGET *target, HTC_PACKET_QUEUE *pList)
struct htc_packet *HTCAllocControlBuffer(struct htc_target *target, struct htc_packet_queue *pList)
{
HTC_PACKET *pPacket;
struct htc_packet *pPacket;
LOCK_HTC(target);
pPacket = HTC_PACKET_DEQUEUE(pList);
@ -62,9 +62,9 @@ HTC_PACKET *HTCAllocControlBuffer(HTC_TARGET *target, HTC_PACKET_QUEUE *pList)
}
/* cleanup the HTC instance */
static void HTCCleanup(HTC_TARGET *target)
static void HTCCleanup(struct htc_target *target)
{
A_INT32 i;
s32 i;
DevCleanup(&target->Device);
@ -90,13 +90,13 @@ static void HTCCleanup(HTC_TARGET *target)
}
/* registered target arrival callback from the HIF layer */
HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
HTC_HANDLE HTCCreate(void *hif_handle, struct htc_init_info *pInfo)
{
HTC_TARGET *target = NULL;
A_STATUS status = A_OK;
struct htc_target *target = NULL;
int status = 0;
int i;
A_UINT32 ctrl_bufsz;
A_UINT32 blocksizes[HTC_MAILBOX_NUM_MAX];
u32 ctrl_bufsz;
u32 blocksizes[HTC_MAILBOX_NUM_MAX];
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCCreate - Enter\n"));
@ -105,13 +105,13 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
do {
/* allocate target memory */
if ((target = (HTC_TARGET *)A_MALLOC(sizeof(HTC_TARGET))) == NULL) {
if ((target = (struct htc_target *)A_MALLOC(sizeof(struct htc_target))) == NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unable to allocate memory\n"));
status = A_ERROR;
break;
}
A_MEMZERO(target, sizeof(HTC_TARGET));
A_MEMZERO(target, sizeof(struct htc_target));
A_MUTEX_INIT(&target->HTCLock);
A_MUTEX_INIT(&target->HTCRxLock);
A_MUTEX_INIT(&target->HTCTxLock);
@ -130,14 +130,14 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
target->Device.MessagePendingCallback = HTCRecvMessagePendingHandler;
target->EpWaitingForBuffers = ENDPOINT_MAX;
A_MEMCPY(&target->HTCInitInfo,pInfo,sizeof(HTC_INIT_INFO));
memcpy(&target->HTCInitInfo,pInfo,sizeof(struct htc_init_info));
ResetEndpointStates(target);
/* setup device layer */
status = DevSetup(&target->Device);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -145,7 +145,7 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
/* get the block sizes */
status = HIFConfigureDevice(hif_handle, HIF_DEVICE_GET_MBOX_BLOCK_SIZE,
blocksizes, sizeof(blocksizes));
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to get block size info from HIF layer...\n"));
break;
}
@ -165,13 +165,13 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
}
}
if (A_FAILED(status)) {
if (status) {
break;
}
/* carve up buffers/packets for control messages */
for (i = 0; i < NUM_CONTROL_RX_BUFFERS; i++) {
HTC_PACKET *pControlPacket;
struct htc_packet *pControlPacket;
pControlPacket = &target->HTCControlBuffers[i].HtcPacket;
SET_HTC_PACKET_INFO_RX_REFILL(pControlPacket,
target,
@ -182,7 +182,7 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
}
for (;i < NUM_CONTROL_BUFFERS;i++) {
HTC_PACKET *pControlPacket;
struct htc_packet *pControlPacket;
pControlPacket = &target->HTCControlBuffers[i].HtcPacket;
INIT_HTC_PACKET_INFO(pControlPacket,
target->HTCControlBuffers[i].Buffer,
@ -190,9 +190,9 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
HTC_FREE_CONTROL_TX(target,pControlPacket);
}
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
if (target != NULL) {
HTCCleanup(target);
target = NULL;
@ -206,7 +206,7 @@ HTC_HANDLE HTCCreate(void *hif_handle, HTC_INIT_INFO *pInfo)
void HTCDestroy(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCDestroy .. Destroying :0x%lX \n",(unsigned long)target));
HTCCleanup(target);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCDestroy \n"));
@ -216,21 +216,21 @@ void HTCDestroy(HTC_HANDLE HTCHandle)
* HIF requests */
void *HTCGetHifDevice(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return target->Device.HIFDevice;
}
/* wait for the target to arrive (sends HTC Ready message)
* this operation is fully synchronous and the message is polled for */
A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
int HTCWaitTarget(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_STATUS status;
HTC_PACKET *pPacket = NULL;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int status;
struct htc_packet *pPacket = NULL;
HTC_READY_EX_MSG *pRdyMsg;
HTC_SERVICE_CONNECT_REQ connect;
HTC_SERVICE_CONNECT_RESP resp;
struct htc_service_connect_req connect;
struct htc_service_connect_resp resp;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCWaitTarget - Enter (target:0x%lX) \n", (unsigned long)target));
@ -240,7 +240,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
status = DoMboxHWTest(&target->Device);
if (status != A_OK) {
if (status) {
break;
}
@ -249,7 +249,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
/* we should be getting 1 control message that the target is ready */
status = HTCWaitforControlMessage(target, &pPacket);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, (" Target Not Available!!\n"));
break;
}
@ -260,7 +260,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
if ((pRdyMsg->Version2_0_Info.MessageID != HTC_MSG_READY_ID) ||
(pPacket->ActualLength < sizeof(HTC_READY_MSG))) {
/* this message is not valid */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
@ -268,7 +268,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
if (pRdyMsg->Version2_0_Info.CreditCount == 0 || pRdyMsg->Version2_0_Info.CreditSize == 0) {
/* this message is not valid */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
@ -305,7 +305,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
/* limit what HTC can handle */
target->MaxMsgPerBundle = min(HTC_HOST_MAX_MSG_PER_BUNDLE, target->MaxMsgPerBundle);
/* target supports message bundling, setup device layer */
if (A_FAILED(DevSetupMsgBundling(&target->Device,target->MaxMsgPerBundle))) {
if (DevSetupMsgBundling(&target->Device,target->MaxMsgPerBundle)) {
/* device layer can't handle bundling */
target->MaxMsgPerBundle = 0;
} else {
@ -320,10 +320,10 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
(" HTC bundling allowed. Max Msg Per HTC Bundle: %d\n", target->MaxMsgPerBundle));
if (DEV_GET_MAX_BUNDLE_SEND_LENGTH(&target->Device) != 0) {
target->SendBundlingEnabled = TRUE;
target->SendBundlingEnabled = true;
}
if (DEV_GET_MAX_BUNDLE_RECV_LENGTH(&target->Device) != 0) {
target->RecvBundlingEnabled = TRUE;
target->RecvBundlingEnabled = true;
}
if (!DEV_IS_LEN_BLOCK_ALIGNED(&target->Device,target->TargetCreditSize)) {
@ -331,7 +331,7 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
target->TargetCreditSize));
/* disallow send bundling since the credit size is not aligned to a block size
* the I/O block padding will spill into the next credit buffer which is fatal */
target->SendBundlingEnabled = FALSE;
target->SendBundlingEnabled = false;
}
}
@ -351,11 +351,11 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
&connect,
&resp);
if (!A_FAILED(status)) {
if (!status) {
break;
}
} while (FALSE);
} while (false);
if (pPacket != NULL) {
HTC_FREE_CONTROL_RX(target,pPacket);
@ -369,11 +369,11 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle)
/* Start HTC, enable interrupts and let the target know host has finished setup */
A_STATUS HTCStart(HTC_HANDLE HTCHandle)
int HTCStart(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_PACKET *pPacket;
A_STATUS status;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_packet *pPacket;
int status;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCStart Enter\n"));
@ -419,26 +419,26 @@ A_STATUS HTCStart(HTC_HANDLE HTCHandle)
* target that the setup phase is complete */
status = HTCSendSetupComplete(target);
if (A_FAILED(status)) {
if (status) {
break;
}
/* unmask interrupts */
status = DevUnmaskInterrupts(&target->Device);
if (A_FAILED(status)) {
if (status) {
HTCStop(target);
}
} while (FALSE);
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HTCStart Exit\n"));
return status;
}
static void ResetEndpointStates(HTC_TARGET *target)
static void ResetEndpointStates(struct htc_target *target)
{
HTC_ENDPOINT *pEndpoint;
struct htc_endpoint *pEndpoint;
int i;
for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) {
@ -463,7 +463,7 @@ static void ResetEndpointStates(HTC_TARGET *target)
/* stop HTC communications, i.e. stop interrupt reception, and flush all queued buffers */
void HTCStop(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCStop \n"));
LOCK_HTC(target);
@ -486,6 +486,8 @@ void HTCStop(HTC_HANDLE HTCHandle)
/* flush all recv buffers */
HTCFlushRecvBuffers(target);
DevCleanupMsgBundling(&target->Device);
ResetEndpointStates(target);
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("-HTCStop \n"));
@ -494,7 +496,7 @@ void HTCStop(HTC_HANDLE HTCHandle)
#ifdef ATH_DEBUG_MODULE
void HTCDumpCreditStates(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
LOCK_HTC_TX(target);
@ -509,9 +511,9 @@ void HTCDumpCreditStates(HTC_HANDLE HTCHandle)
* which uses a mechanism to report errors from the target (i.e. special interrupts) */
static void HTCReportFailure(void *Context)
{
HTC_TARGET *target = (HTC_TARGET *)Context;
struct htc_target *target = (struct htc_target *)Context;
target->TargetFailure = TRUE;
target->TargetFailure = true;
if (target->HTCInitInfo.TargetFailure != NULL) {
/* let upper layer know, it needs to call HTCStop() */
@ -519,27 +521,27 @@ static void HTCReportFailure(void *Context)
}
}
A_BOOL HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
bool HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
HTC_ENDPOINT_STAT_ACTION Action,
HTC_ENDPOINT_STATS *pStats)
struct htc_endpoint_stats *pStats)
{
#ifdef HTC_EP_STAT_PROFILING
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_BOOL clearStats = FALSE;
A_BOOL sample = FALSE;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
bool clearStats = false;
bool sample = false;
switch (Action) {
case HTC_EP_STAT_SAMPLE :
sample = TRUE;
sample = true;
break;
case HTC_EP_STAT_SAMPLE_AND_CLEAR :
sample = TRUE;
clearStats = TRUE;
sample = true;
clearStats = true;
break;
case HTC_EP_STAT_CLEAR :
clearStats = TRUE;
clearStats = true;
break;
default:
break;
@ -554,26 +556,26 @@ A_BOOL HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
if (sample) {
A_ASSERT(pStats != NULL);
/* return the stats to the caller */
A_MEMCPY(pStats, &target->EndPoint[Endpoint].EndPointStats, sizeof(HTC_ENDPOINT_STATS));
memcpy(pStats, &target->EndPoint[Endpoint].EndPointStats, sizeof(struct htc_endpoint_stats));
}
if (clearStats) {
/* reset stats */
A_MEMZERO(&target->EndPoint[Endpoint].EndPointStats, sizeof(HTC_ENDPOINT_STATS));
A_MEMZERO(&target->EndPoint[Endpoint].EndPointStats, sizeof(struct htc_endpoint_stats));
}
UNLOCK_HTC_RX(target);
UNLOCK_HTC_TX(target);
return TRUE;
return true;
#else
return FALSE;
return false;
#endif
}
AR6K_DEVICE *HTCGetAR6KDevice(void *HTCHandle)
struct ar6k_device *HTCGetAR6KDevice(void *HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return &target->Device;
}

View File

@ -65,27 +65,27 @@ extern "C" {
#define HTC_SCATTER_REQ_FLAGS_PARTIAL_BUNDLE (1 << 0)
typedef struct _HTC_ENDPOINT {
struct htc_endpoint {
HTC_ENDPOINT_ID Id;
HTC_SERVICE_ID ServiceID; /* service ID this endpoint is bound to
non-zero value means this endpoint is in use */
HTC_PACKET_QUEUE TxQueue; /* HTC frame buffer TX queue */
HTC_PACKET_QUEUE RxBuffers; /* HTC frame buffer RX list */
HTC_ENDPOINT_CREDIT_DIST CreditDist; /* credit distribution structure (exposed to driver layer) */
HTC_EP_CALLBACKS EpCallBacks; /* callbacks associated with this endpoint */
struct htc_packet_queue TxQueue; /* HTC frame buffer TX queue */
struct htc_packet_queue RxBuffers; /* HTC frame buffer RX list */
struct htc_endpoint_credit_dist CreditDist; /* credit distribution structure (exposed to driver layer) */
struct htc_ep_callbacks EpCallBacks; /* callbacks associated with this endpoint */
int MaxTxQueueDepth; /* max depth of the TX queue before we need to
call driver's full handler */
int MaxMsgLength; /* max length of endpoint message */
int TxProcessCount; /* reference count to continue tx processing */
HTC_PACKET_QUEUE RecvIndicationQueue; /* recv packets ready to be indicated */
struct htc_packet_queue RecvIndicationQueue; /* recv packets ready to be indicated */
int RxProcessCount; /* reference count to allow single processing context */
struct _HTC_TARGET *target; /* back pointer to target */
A_UINT8 SeqNo; /* TX seq no (helpful) for debugging */
A_UINT32 LocalConnectionFlags; /* local connection flags */
struct htc_target *target; /* back pointer to target */
u8 SeqNo; /* TX seq no (helpful) for debugging */
u32 LocalConnectionFlags; /* local connection flags */
#ifdef HTC_EP_STAT_PROFILING
HTC_ENDPOINT_STATS EndPointStats; /* endpoint statistics */
struct htc_endpoint_stats EndPointStats; /* endpoint statistics */
#endif
} HTC_ENDPOINT;
};
#ifdef HTC_EP_STAT_PROFILING
#define INC_HTC_EP_STAT(p,stat,count) (p)->EndPointStats.stat += (count);
@ -99,21 +99,21 @@ typedef struct _HTC_ENDPOINT {
#define NUM_CONTROL_TX_BUFFERS 2
#define NUM_CONTROL_RX_BUFFERS (NUM_CONTROL_BUFFERS - NUM_CONTROL_TX_BUFFERS)
typedef struct HTC_CONTROL_BUFFER {
HTC_PACKET HtcPacket;
A_UINT8 *Buffer;
} HTC_CONTROL_BUFFER;
struct htc_control_buffer {
struct htc_packet HtcPacket;
u8 *Buffer;
};
#define HTC_RECV_WAIT_BUFFERS (1 << 0)
#define HTC_OP_STATE_STOPPING (1 << 0)
/* our HTC target state */
typedef struct _HTC_TARGET {
HTC_ENDPOINT EndPoint[ENDPOINT_MAX];
HTC_CONTROL_BUFFER HTCControlBuffers[NUM_CONTROL_BUFFERS];
HTC_ENDPOINT_CREDIT_DIST *EpCreditDistributionListHead;
HTC_PACKET_QUEUE ControlBufferTXFreeList;
HTC_PACKET_QUEUE ControlBufferRXFreeList;
struct htc_target {
struct htc_endpoint EndPoint[ENDPOINT_MAX];
struct htc_control_buffer HTCControlBuffers[NUM_CONTROL_BUFFERS];
struct htc_endpoint_credit_dist *EpCreditDistributionListHead;
struct htc_packet_queue ControlBufferTXFreeList;
struct htc_packet_queue ControlBufferRXFreeList;
HTC_CREDIT_DIST_CALLBACK DistributeCredits;
HTC_CREDIT_INIT_CALLBACK InitCredits;
void *pCredDistContext;
@ -122,22 +122,22 @@ typedef struct _HTC_TARGET {
A_MUTEX_T HTCLock;
A_MUTEX_T HTCRxLock;
A_MUTEX_T HTCTxLock;
AR6K_DEVICE Device; /* AR6K - specific state */
A_UINT32 OpStateFlags;
A_UINT32 RecvStateFlags;
struct ar6k_device Device; /* AR6K - specific state */
u32 OpStateFlags;
u32 RecvStateFlags;
HTC_ENDPOINT_ID EpWaitingForBuffers;
A_BOOL TargetFailure;
bool TargetFailure;
#ifdef HTC_CAPTURE_LAST_FRAME
HTC_FRAME_HDR LastFrameHdr; /* useful for debugging */
A_UINT8 LastTrailer[256];
A_UINT8 LastTrailerLength;
struct htc_frame_hdr LastFrameHdr; /* useful for debugging */
u8 LastTrailer[256];
u8 LastTrailerLength;
#endif
HTC_INIT_INFO HTCInitInfo;
A_UINT8 HTCTargetVersion;
struct htc_init_info HTCInitInfo;
u8 HTCTargetVersion;
int MaxMsgPerBundle; /* max messages per bundle for HTC */
A_BOOL SendBundlingEnabled; /* run time enable for send bundling (dynamic) */
bool SendBundlingEnabled; /* run time enable for send bundling (dynamic) */
int RecvBundlingEnabled; /* run time enable for recv bundling (dynamic) */
} HTC_TARGET;
};
#define HTC_STOPPING(t) ((t)->OpStateFlags & HTC_OP_STATE_STOPPING)
#define LOCK_HTC(t) A_MUTEX_LOCK(&(t)->HTCLock);
@ -147,7 +147,7 @@ typedef struct _HTC_TARGET {
#define LOCK_HTC_TX(t) A_MUTEX_LOCK(&(t)->HTCTxLock);
#define UNLOCK_HTC_TX(t) A_MUTEX_UNLOCK(&(t)->HTCTxLock);
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((struct htc_target *)(hnd))
#define HTC_RECYCLE_RX_PKT(target,p,e) \
{ \
if ((p)->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_NO_RECYCLE) { \
@ -162,27 +162,27 @@ typedef struct _HTC_TARGET {
}
/* internal HTC functions */
void HTCControlTxComplete(void *Context, HTC_PACKET *pPacket);
void HTCControlRecv(void *Context, HTC_PACKET *pPacket);
A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPacket);
HTC_PACKET *HTCAllocControlBuffer(HTC_TARGET *target, HTC_PACKET_QUEUE *pList);
void HTCFreeControlBuffer(HTC_TARGET *target, HTC_PACKET *pPacket, HTC_PACKET_QUEUE *pList);
A_STATUS HTCIssueSend(HTC_TARGET *target, HTC_PACKET *pPacket);
void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket);
A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int NumLookAheads, A_BOOL *pAsyncProc, int *pNumPktsFetched);
void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
A_STATUS HTCSendSetupComplete(HTC_TARGET *target);
void HTCFlushRecvBuffers(HTC_TARGET *target);
void HTCFlushSendPkts(HTC_TARGET *target);
void HTCControlTxComplete(void *Context, struct htc_packet *pPacket);
void HTCControlRecv(void *Context, struct htc_packet *pPacket);
int HTCWaitforControlMessage(struct htc_target *target, struct htc_packet **ppControlPacket);
struct htc_packet *HTCAllocControlBuffer(struct htc_target *target, struct htc_packet_queue *pList);
void HTCFreeControlBuffer(struct htc_target *target, struct htc_packet *pPacket, struct htc_packet_queue *pList);
int HTCIssueSend(struct htc_target *target, struct htc_packet *pPacket);
void HTCRecvCompleteHandler(void *Context, struct htc_packet *pPacket);
int HTCRecvMessagePendingHandler(void *Context, u32 MsgLookAheads[], int NumLookAheads, bool *pAsyncProc, int *pNumPktsFetched);
void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint);
int HTCSendSetupComplete(struct htc_target *target);
void HTCFlushRecvBuffers(struct htc_target *target);
void HTCFlushSendPkts(struct htc_target *target);
#ifdef ATH_DEBUG_MODULE
void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist);
void DumpCreditDistStates(HTC_TARGET *target);
void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription);
void DumpCreditDist(struct htc_endpoint_credit_dist *pEPDist);
void DumpCreditDistStates(struct htc_target *target);
void DebugDumpBytes(u8 *buffer, u16 length, char *pDescription);
#endif
static INLINE HTC_PACKET *HTC_ALLOC_CONTROL_TX(HTC_TARGET *target) {
HTC_PACKET *pPacket = HTCAllocControlBuffer(target,&target->ControlBufferTXFreeList);
static INLINE struct htc_packet *HTC_ALLOC_CONTROL_TX(struct htc_target *target) {
struct htc_packet *pPacket = HTCAllocControlBuffer(target,&target->ControlBufferTXFreeList);
if (pPacket != NULL) {
/* set payload pointer area with some headroom */
pPacket->pBuffer = pPacket->pBufferStart + HTC_HDR_LENGTH;
@ -200,14 +200,14 @@ static INLINE HTC_PACKET *HTC_ALLOC_CONTROL_TX(HTC_TARGET *target) {
#define HTC_PREPARE_SEND_PKT(pP,sendflags,ctrl0,ctrl1) \
{ \
A_UINT8 *pHdrBuf; \
u8 *pHdrBuf; \
(pP)->pBuffer -= HTC_HDR_LENGTH; \
pHdrBuf = (pP)->pBuffer; \
A_SET_UINT16_FIELD(pHdrBuf,HTC_FRAME_HDR,PayloadLen,(A_UINT16)(pP)->ActualLength); \
A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,Flags,(sendflags)); \
A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,EndpointID, (A_UINT8)(pP)->Endpoint); \
A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[0], (A_UINT8)(ctrl0)); \
A_SET_UINT8_FIELD(pHdrBuf,HTC_FRAME_HDR,ControlBytes[1], (A_UINT8)(ctrl1)); \
A_SET_UINT16_FIELD(pHdrBuf,struct htc_frame_hdr,PayloadLen,(u16)(pP)->ActualLength); \
A_SET_UINT8_FIELD(pHdrBuf,struct htc_frame_hdr,Flags,(sendflags)); \
A_SET_UINT8_FIELD(pHdrBuf,struct htc_frame_hdr,EndpointID, (u8)(pP)->Endpoint); \
A_SET_UINT8_FIELD(pHdrBuf,struct htc_frame_hdr,ControlBytes[0], (u8)(ctrl0)); \
A_SET_UINT8_FIELD(pHdrBuf,struct htc_frame_hdr,ControlBytes[1], (u8)(ctrl1)); \
}
#define HTC_UNPREPARE_SEND_PKT(pP) \

View File

@ -50,8 +50,8 @@
#define HTC_RX_STAT_PROFILE(t,ep,lookAhead)
#endif
static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pQueueToIndicate)
static void DoRecvCompletion(struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueueToIndicate)
{
do {
@ -69,7 +69,7 @@ static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint,
pQueueToIndicate);
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
struct htc_packet *pPacket;
/* using legacy EpRecv */
do {
pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate);
@ -79,23 +79,23 @@ static void DoRecvCompletion(HTC_ENDPOINT *pEndpoint,
} while (!HTC_QUEUE_EMPTY(pQueueToIndicate));
}
} while (FALSE);
} while (false);
}
static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
A_UINT8 *pBuffer,
static INLINE int HTCProcessTrailer(struct htc_target *target,
u8 *pBuffer,
int Length,
A_UINT32 *pNextLookAheads,
u32 *pNextLookAheads,
int *pNumLookAheads,
HTC_ENDPOINT_ID FromEndpoint)
{
HTC_RECORD_HDR *pRecord;
A_UINT8 *pRecordBuf;
u8 *pRecordBuf;
HTC_LOOKAHEAD_REPORT *pLookAhead;
A_UINT8 *pOrigBuffer;
u8 *pOrigBuffer;
int origLength;
A_STATUS status;
int status;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCProcessTrailer (length:%d) \n", Length));
@ -105,7 +105,7 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
pOrigBuffer = pBuffer;
origLength = Length;
status = A_OK;
status = 0;
while (Length > 0) {
@ -149,14 +149,14 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
pLookAhead->PostValid));
/* look ahead bytes are valid, copy them over */
((A_UINT8 *)(&pNextLookAheads[0]))[0] = pLookAhead->LookAhead[0];
((A_UINT8 *)(&pNextLookAheads[0]))[1] = pLookAhead->LookAhead[1];
((A_UINT8 *)(&pNextLookAheads[0]))[2] = pLookAhead->LookAhead[2];
((A_UINT8 *)(&pNextLookAheads[0]))[3] = pLookAhead->LookAhead[3];
((u8 *)(&pNextLookAheads[0]))[0] = pLookAhead->LookAhead[0];
((u8 *)(&pNextLookAheads[0]))[1] = pLookAhead->LookAhead[1];
((u8 *)(&pNextLookAheads[0]))[2] = pLookAhead->LookAhead[2];
((u8 *)(&pNextLookAheads[0]))[3] = pLookAhead->LookAhead[3];
#ifdef ATH_DEBUG_MODULE
if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
DebugDumpBytes((A_UINT8 *)pNextLookAheads,4,"Next Look Ahead");
DebugDumpBytes((u8 *)pNextLookAheads,4,"Next Look Ahead");
}
#endif
/* just one normal lookahead */
@ -182,16 +182,16 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
HTC_HOST_MAX_MSG_PER_BUNDLE) {
/* this should never happen, the target restricts the number
* of messages per bundle configured by the host */
A_ASSERT(FALSE);
A_ASSERT(false);
status = A_EPROTO;
break;
}
for (i = 0; i < (int)(pRecord->Length / (sizeof(HTC_BUNDLED_LOOKAHEAD_REPORT))); i++) {
((A_UINT8 *)(&pNextLookAheads[i]))[0] = pBundledLookAheadRpt->LookAhead[0];
((A_UINT8 *)(&pNextLookAheads[i]))[1] = pBundledLookAheadRpt->LookAhead[1];
((A_UINT8 *)(&pNextLookAheads[i]))[2] = pBundledLookAheadRpt->LookAhead[2];
((A_UINT8 *)(&pNextLookAheads[i]))[3] = pBundledLookAheadRpt->LookAhead[3];
((u8 *)(&pNextLookAheads[i]))[0] = pBundledLookAheadRpt->LookAhead[0];
((u8 *)(&pNextLookAheads[i]))[1] = pBundledLookAheadRpt->LookAhead[1];
((u8 *)(&pNextLookAheads[i]))[2] = pBundledLookAheadRpt->LookAhead[2];
((u8 *)(&pNextLookAheads[i]))[3] = pBundledLookAheadRpt->LookAhead[3];
pBundledLookAheadRpt++;
}
@ -204,7 +204,7 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
break;
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -214,7 +214,7 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
}
#ifdef ATH_DEBUG_MODULE
if (A_FAILED(status)) {
if (status) {
DebugDumpBytes(pOrigBuffer,origLength,"BAD Recv Trailer");
}
#endif
@ -226,16 +226,16 @@ static INLINE A_STATUS HTCProcessTrailer(HTC_TARGET *target,
/* process a received message (i.e. strip off header, process any trailer data)
* note : locks must be released when this function is called */
static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
HTC_PACKET *pPacket,
A_UINT32 *pNextLookAheads,
static int HTCProcessRecvHeader(struct htc_target *target,
struct htc_packet *pPacket,
u32 *pNextLookAheads,
int *pNumLookAheads)
{
A_UINT8 temp;
A_UINT8 *pBuf;
A_STATUS status = A_OK;
A_UINT16 payloadLen;
A_UINT32 lookAhead;
u8 temp;
u8 *pBuf;
int status = 0;
u16 payloadLen;
u32 lookAhead;
pBuf = pPacket->pBuffer;
@ -252,12 +252,12 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
do {
/* note, we cannot assume the alignment of pBuffer, so we use the safe macros to
* retrieve 16 bit fields */
payloadLen = A_GET_UINT16_FIELD(pBuf, HTC_FRAME_HDR, PayloadLen);
payloadLen = A_GET_UINT16_FIELD(pBuf, struct htc_frame_hdr, PayloadLen);
((A_UINT8 *)&lookAhead)[0] = pBuf[0];
((A_UINT8 *)&lookAhead)[1] = pBuf[1];
((A_UINT8 *)&lookAhead)[2] = pBuf[2];
((A_UINT8 *)&lookAhead)[3] = pBuf[3];
((u8 *)&lookAhead)[0] = pBuf[0];
((u8 *)&lookAhead)[1] = pBuf[1];
((u8 *)&lookAhead)[2] = pBuf[2];
((u8 *)&lookAhead)[3] = pBuf[3];
if (pPacket->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_REFRESH_HDR) {
/* refresh expected hdr, since this was unknown at the time we grabbed the packets
@ -277,10 +277,10 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
break;
}
if (pPacket->Endpoint != A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, EndpointID)) {
if (pPacket->Endpoint != A_GET_UINT8_FIELD(pBuf, struct htc_frame_hdr, EndpointID)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Refreshed HDR endpoint (%d) does not match expected endpoint (%d) \n",
A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, EndpointID), pPacket->Endpoint));
A_GET_UINT8_FIELD(pBuf, struct htc_frame_hdr, EndpointID), pPacket->Endpoint));
status = A_EPROTO;
break;
}
@ -293,10 +293,10 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
("HTCProcessRecvHeader, lookahead mismatch! (pPkt:0x%lX flags:0x%X) \n",
(unsigned long)pPacket, pPacket->PktInfo.AsRx.HTCRxFlags));
#ifdef ATH_DEBUG_MODULE
DebugDumpBytes((A_UINT8 *)&pPacket->PktInfo.AsRx.ExpectedHdr,4,"Expected Message LookAhead");
DebugDumpBytes(pBuf,sizeof(HTC_FRAME_HDR),"Current Frame Header");
DebugDumpBytes((u8 *)&pPacket->PktInfo.AsRx.ExpectedHdr,4,"Expected Message LookAhead");
DebugDumpBytes(pBuf,sizeof(struct htc_frame_hdr),"Current Frame Header");
#ifdef HTC_CAPTURE_LAST_FRAME
DebugDumpBytes((A_UINT8 *)&target->LastFrameHdr,sizeof(HTC_FRAME_HDR),"Last Frame Header");
DebugDumpBytes((u8 *)&target->LastFrameHdr,sizeof(struct htc_frame_hdr),"Last Frame Header");
if (target->LastTrailerLength != 0) {
DebugDumpBytes(target->LastTrailer,
target->LastTrailerLength,
@ -309,13 +309,13 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
}
/* get flags */
temp = A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, Flags);
temp = A_GET_UINT8_FIELD(pBuf, struct htc_frame_hdr, Flags);
if (temp & HTC_FLAGS_RECV_TRAILER) {
/* this packet has a trailer */
/* extract the trailer length in control byte 0 */
temp = A_GET_UINT8_FIELD(pBuf, HTC_FRAME_HDR, ControlBytes[0]);
temp = A_GET_UINT8_FIELD(pBuf, struct htc_frame_hdr, ControlBytes[0]);
if ((temp < sizeof(HTC_RECORD_HDR)) || (temp > payloadLen)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
@ -341,12 +341,12 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
pNumLookAheads,
pPacket->Endpoint);
if (A_FAILED(status)) {
if (status) {
break;
}
#ifdef HTC_CAPTURE_LAST_FRAME
A_MEMCPY(target->LastTrailer, (pBuf + HTC_HDR_LENGTH + payloadLen - temp), temp);
memcpy(target->LastTrailer, (pBuf + HTC_HDR_LENGTH + payloadLen - temp), temp);
target->LastTrailerLength = temp;
#endif
/* trim length by trailer bytes */
@ -363,16 +363,16 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
pPacket->pBuffer += HTC_HDR_LENGTH;
pPacket->ActualLength -= HTC_HDR_LENGTH;
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
/* dump the whole packet */
#ifdef ATH_DEBUG_MODULE
DebugDumpBytes(pBuf,pPacket->ActualLength < 256 ? pPacket->ActualLength : 256 ,"BAD HTC Recv PKT");
#endif
} else {
#ifdef HTC_CAPTURE_LAST_FRAME
A_MEMCPY(&target->LastFrameHdr,pBuf,sizeof(HTC_FRAME_HDR));
memcpy(&target->LastFrameHdr,pBuf,sizeof(struct htc_frame_hdr));
#endif
if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_RECV)) {
if (pPacket->ActualLength > 0) {
@ -385,14 +385,14 @@ static A_STATUS HTCProcessRecvHeader(HTC_TARGET *target,
return status;
}
static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
A_UINT32 NextLookAheads[],
static INLINE void HTCAsyncRecvCheckMorePackets(struct htc_target *target,
u32 NextLookAheads[],
int NumLookAheads,
A_BOOL CheckMoreMsgs)
bool CheckMoreMsgs)
{
/* was there a lookahead for the next packet? */
if (NumLookAheads > 0) {
A_STATUS nextStatus;
int nextStatus;
int fetched = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("HTCAsyncRecvCheckMorePackets - num lookaheads were non-zero : %d \n",
@ -405,12 +405,12 @@ static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Next look ahead from recv header was INVALID\n"));
#ifdef ATH_DEBUG_MODULE
DebugDumpBytes((A_UINT8 *)NextLookAheads,
NumLookAheads * (sizeof(A_UINT32)),
DebugDumpBytes((u8 *)NextLookAheads,
NumLookAheads * (sizeof(u32)),
"BAD lookaheads from lookahead report");
#endif
}
if (A_SUCCESS(nextStatus) && !fetched) {
if (!nextStatus && !fetched) {
/* we could not fetch any more packets due to resources */
DevAsyncIrqProcessComplete(&target->Device);
}
@ -432,9 +432,9 @@ static INLINE void HTCAsyncRecvCheckMorePackets(HTC_TARGET *target,
}
/* unload the recv completion queue */
static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint)
static INLINE void DrainRecvIndicationQueue(struct htc_target *target, struct htc_endpoint *pEndpoint)
{
HTC_PACKET_QUEUE recvCompletions;
struct htc_packet_queue recvCompletions;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+DrainRecvIndicationQueue \n"));
@ -454,7 +454,7 @@ static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, HTC_ENDPOINT *pE
/******* at this point only 1 thread may enter ******/
while (TRUE) {
while (true) {
/* transfer items from main recv queue to the local one so we can release the lock */
HTC_PACKET_QUEUE_TRANSFER_TO_TAIL(&recvCompletions, &pEndpoint->RecvIndicationQueue);
@ -496,11 +496,11 @@ static INLINE void DrainRecvIndicationQueue(HTC_TARGET *target, HTC_ENDPOINT *pE
(P)->PktInfo.AsRx.IndicationFlags |= HTC_RX_FLAGS_INDICATE_MORE_PKTS;
/* note: this function can be called with the RX lock held */
static INLINE void SetRxPacketIndicationFlags(A_UINT32 LookAhead,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET *pPacket)
static INLINE void SetRxPacketIndicationFlags(u32 LookAhead,
struct htc_endpoint *pEndpoint,
struct htc_packet *pPacket)
{
HTC_FRAME_HDR *pHdr = (HTC_FRAME_HDR *)&LookAhead;
struct htc_frame_hdr *pHdr = (struct htc_frame_hdr *)&LookAhead;
/* check to see if the "next" packet is from the same endpoint of the
completing packet */
if (pHdr->EndpointID == pPacket->Endpoint) {
@ -515,14 +515,14 @@ static INLINE void SetRxPacketIndicationFlags(A_UINT32 LookAhead,
/* asynchronous completion handler for recv packet fetching, when the device layer
* completes a read request, it will call this completion handler */
void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
void HTCRecvCompleteHandler(void *Context, struct htc_packet *pPacket)
{
HTC_TARGET *target = (HTC_TARGET *)Context;
HTC_ENDPOINT *pEndpoint;
A_UINT32 nextLookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
struct htc_target *target = (struct htc_target *)Context;
struct htc_endpoint *pEndpoint;
u32 nextLookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
int numLookAheads = 0;
A_STATUS status;
A_BOOL checkMorePkts = TRUE;
int status;
bool checkMorePkts = true;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, ("+HTCRecvCompleteHandler (pkt:0x%lX, status:%d, ep:%d) \n",
(unsigned long)pPacket, pPacket->Status, pPacket->Endpoint));
@ -537,7 +537,7 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
do {
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HTCRecvCompleteHandler: request failed (status:%d, ep:%d) \n",
pPacket->Status, pPacket->Endpoint));
break;
@ -545,7 +545,7 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
/* process the header for any trailer data */
status = HTCProcessRecvHeader(target,pPacket,nextLookAheads,&numLookAheads);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -554,7 +554,7 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
* It was fetched one message at a time. There may be other asynchronous reads queued behind this one.
* Do no issue another check for more packets since the last one in the series of requests
* will handle it */
checkMorePkts = FALSE;
checkMorePkts = false;
}
DUMP_RECV_PKT_INFO(pPacket);
@ -568,9 +568,9 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
/* check for more recv packets before indicating */
HTCAsyncRecvCheckMorePackets(target,nextLookAheads,numLookAheads,checkMorePkts);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("HTCRecvCompleteHandler , message fetch failed (status = %d) \n",
status));
@ -587,12 +587,12 @@ void HTCRecvCompleteHandler(void *Context, HTC_PACKET *pPacket)
/* synchronously wait for a control message from the target,
* This function is used at initialization time ONLY. At init messages
* on ENDPOINT 0 are expected. */
A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPacket)
int HTCWaitforControlMessage(struct htc_target *target, struct htc_packet **ppControlPacket)
{
A_STATUS status;
A_UINT32 lookAhead;
HTC_PACKET *pPacket = NULL;
HTC_FRAME_HDR *pHdr;
int status;
u32 lookAhead;
struct htc_packet *pPacket = NULL;
struct htc_frame_hdr *pHdr;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCWaitforControlMessage \n"));
@ -605,7 +605,7 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
&lookAhead,
HTC_TARGET_RESPONSE_TIMEOUT);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -613,18 +613,18 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
("HTCWaitforControlMessage : lookAhead : 0x%X \n", lookAhead));
/* check the lookahead */
pHdr = (HTC_FRAME_HDR *)&lookAhead;
pHdr = (struct htc_frame_hdr *)&lookAhead;
if (pHdr->EndpointID != ENDPOINT_0) {
/* unexpected endpoint number, should be zero */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
if (A_FAILED(status)) {
if (status) {
/* bad message */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
@ -632,7 +632,7 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
pPacket = HTC_ALLOC_CONTROL_RX(target);
if (pPacket == NULL) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_NO_MEMORY;
break;
}
@ -642,7 +642,7 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
pPacket->ActualLength = pHdr->PayloadLen + HTC_HDR_LENGTH;
if (pPacket->ActualLength > pPacket->BufferLength) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
@ -653,7 +653,7 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
/* get the message from the device, this will block */
status = HTCIssueRecv(target, pPacket);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -662,7 +662,7 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
pPacket->Status = status;
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("HTCWaitforControlMessage, HTCProcessRecvHeader failed (status = %d) \n",
status));
@ -672,9 +672,9 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
/* give the caller this control message packet, they are responsible to free */
*ppControlPacket = pPacket;
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
if (pPacket != NULL) {
/* cleanup buffer on error */
HTC_FREE_CONTROL_RX(target,pPacket);
@ -686,26 +686,26 @@ A_STATUS HTCWaitforControlMessage(HTC_TARGET *target, HTC_PACKET **ppControlPack
return status;
}
static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
A_UINT32 LookAheads[],
static int AllocAndPrepareRxPackets(struct htc_target *target,
u32 LookAheads[],
int Messages,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pQueue)
struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueue)
{
A_STATUS status = A_OK;
HTC_PACKET *pPacket;
HTC_FRAME_HDR *pHdr;
int status = 0;
struct htc_packet *pPacket;
struct htc_frame_hdr *pHdr;
int i,j;
int numMessages;
int fullLength;
A_BOOL noRecycle;
bool noRecycle;
/* lock RX while we assemble the packet buffers */
LOCK_HTC_RX(target);
for (i = 0; i < Messages; i++) {
pHdr = (HTC_FRAME_HDR *)&LookAheads[i];
pHdr = (struct htc_frame_hdr *)&LookAheads[i];
if (pHdr->EndpointID >= ENDPOINT_MAX) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Invalid Endpoint in look-ahead: %d \n",pHdr->EndpointID));
@ -724,7 +724,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
if (pHdr->PayloadLen > HTC_MAX_PAYLOAD_LENGTH) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Payload length %d exceeds max HTC : %d !\n",
pHdr->PayloadLen, (A_UINT32)HTC_MAX_PAYLOAD_LENGTH));
pHdr->PayloadLen, (u32)HTC_MAX_PAYLOAD_LENGTH));
status = A_EPROTO;
break;
}
@ -751,7 +751,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
("HTC header indicates :%d messages can be fetched as a bundle \n",numMessages));
}
fullLength = DEV_CALC_RECV_PADDED_LEN(&target->Device,pHdr->PayloadLen + sizeof(HTC_FRAME_HDR));
fullLength = DEV_CALC_RECV_PADDED_LEN(&target->Device,pHdr->PayloadLen + sizeof(struct htc_frame_hdr));
/* get packet buffers for each message, if there was a bundle detected in the header,
* use pHdr as a template to fetch all packets in the bundle */
@ -759,11 +759,11 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
/* reset flag, any packets allocated using the RecvAlloc() API cannot be recycled on cleanup,
* they must be explicitly returned */
noRecycle = FALSE;
noRecycle = false;
if (pEndpoint->EpCallBacks.EpRecvAlloc != NULL) {
UNLOCK_HTC_RX(target);
noRecycle = TRUE;
noRecycle = true;
/* user is using a per-packet allocation callback */
pPacket = pEndpoint->EpCallBacks.EpRecvAlloc(pEndpoint->EpCallBacks.pContext,
pEndpoint->Id,
@ -776,7 +776,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
INC_HTC_EP_STAT(pEndpoint,RxAllocThreshBytes,pHdr->PayloadLen);
/* threshold was hit, call the special recv allocation callback */
UNLOCK_HTC_RX(target);
noRecycle = TRUE;
noRecycle = true;
/* user wants to allocate packets above a certain threshold */
pPacket = pEndpoint->EpCallBacks.EpRecvAllocThresh(pEndpoint->EpCallBacks.pContext,
pEndpoint->Id,
@ -816,7 +816,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
/* clear flags */
pPacket->PktInfo.AsRx.HTCRxFlags = 0;
pPacket->PktInfo.AsRx.IndicationFlags = 0;
pPacket->Status = A_OK;
pPacket->Status = 0;
if (noRecycle) {
/* flag that these packets cannot be recycled, they have to be returned to the
@ -832,7 +832,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
}
/* make sure this message can fit in the endpoint buffer */
if ((A_UINT32)fullLength > pPacket->BufferLength) {
if ((u32)fullLength > pPacket->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Payload Length Error : header reports payload of: %d (%d) endpoint buffer size: %d \n",
pHdr->PayloadLen, fullLength, pPacket->BufferLength));
@ -856,10 +856,10 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
pPacket->ActualLength = pHdr->PayloadLen + HTC_HDR_LENGTH;
}
if (A_FAILED(status)) {
if (status) {
if (A_NO_RESOURCE == status) {
/* this is actually okay */
status = A_OK;
status = 0;
}
break;
}
@ -868,7 +868,7 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
UNLOCK_HTC_RX(target);
if (A_FAILED(status)) {
if (status) {
while (!HTC_QUEUE_EMPTY(pQueue)) {
pPacket = HTC_PACKET_DEQUEUE(pQueue);
/* recycle all allocated packets */
@ -879,37 +879,37 @@ static A_STATUS AllocAndPrepareRxPackets(HTC_TARGET *target,
return status;
}
static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
static void HTCAsyncRecvScatterCompletion(struct hif_scatter_req *pScatterReq)
{
int i;
HTC_PACKET *pPacket;
HTC_ENDPOINT *pEndpoint;
A_UINT32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
struct htc_packet *pPacket;
struct htc_endpoint *pEndpoint;
u32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
int numLookAheads = 0;
HTC_TARGET *target = (HTC_TARGET *)pScatterReq->Context;
A_STATUS status;
A_BOOL partialBundle = FALSE;
HTC_PACKET_QUEUE localRecvQueue;
A_BOOL procError = FALSE;
struct htc_target *target = (struct htc_target *)pScatterReq->Context;
int status;
bool partialBundle = false;
struct htc_packet_queue localRecvQueue;
bool procError = false;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("+HTCAsyncRecvScatterCompletion TotLen: %d Entries: %d\n",
pScatterReq->TotalLength, pScatterReq->ValidScatterEntries));
A_ASSERT(!IS_DEV_IRQ_PROC_SYNC_MODE(&target->Device));
if (A_FAILED(pScatterReq->CompletionStatus)) {
if (pScatterReq->CompletionStatus) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** Recv Scatter Request Failed: %d \n",pScatterReq->CompletionStatus));
}
if (pScatterReq->CallerFlags & HTC_SCATTER_REQ_FLAGS_PARTIAL_BUNDLE) {
partialBundle = TRUE;
partialBundle = true;
}
DEV_FINISH_SCATTER_OPERATION(pScatterReq);
INIT_HTC_PACKET_QUEUE(&localRecvQueue);
pPacket = (HTC_PACKET *)pScatterReq->ScatterList[0].pCallerContexts[0];
pPacket = (struct htc_packet *)pScatterReq->ScatterList[0].pCallerContexts[0];
/* note: all packets in a scatter req are for the same endpoint ! */
pEndpoint = &target->EndPoint[pPacket->Endpoint];
@ -917,20 +917,20 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
/* **** NOTE: DO NOT HOLD ANY LOCKS here, HTCProcessRecvHeader can take the TX lock
* as it processes credit reports */
for (i = 0; i < pScatterReq->ValidScatterEntries; i++) {
pPacket = (HTC_PACKET *)pScatterReq->ScatterList[i].pCallerContexts[0];
pPacket = (struct htc_packet *)pScatterReq->ScatterList[i].pCallerContexts[0];
A_ASSERT(pPacket != NULL);
/* reset count, we are only interested in the look ahead in the last packet when we
* break out of this loop */
numLookAheads = 0;
if (A_SUCCESS(pScatterReq->CompletionStatus)) {
if (!pScatterReq->CompletionStatus) {
/* process header for each of the recv packets */
status = HTCProcessRecvHeader(target,pPacket,lookAheads,&numLookAheads);
} else {
status = A_ERROR;
}
if (A_SUCCESS(status)) {
if (!status) {
#ifdef HTC_EP_STAT_PROFILING
LOCK_HTC_RX(target);
HTC_RX_STAT_PROFILE(target,pEndpoint,numLookAheads);
@ -956,7 +956,7 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
/* recycle failed recv */
HTC_RECYCLE_RX_PKT(target, pPacket, pEndpoint);
/* set flag and continue processing the remaining scatter entries */
procError = TRUE;
procError = true;
}
}
@ -975,7 +975,7 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
HTCAsyncRecvCheckMorePackets(target,
lookAheads,
numLookAheads,
partialBundle ? FALSE : TRUE);
partialBundle ? false : true);
}
/* now drain the indication queue */
@ -984,18 +984,18 @@ static void HTCAsyncRecvScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCAsyncRecvScatterCompletion \n"));
}
static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target,
HTC_PACKET_QUEUE *pRecvPktQueue,
HTC_PACKET_QUEUE *pSyncCompletionQueue,
static int HTCIssueRecvPacketBundle(struct htc_target *target,
struct htc_packet_queue *pRecvPktQueue,
struct htc_packet_queue *pSyncCompletionQueue,
int *pNumPacketsFetched,
A_BOOL PartialBundle)
bool PartialBundle)
{
A_STATUS status = A_OK;
HIF_SCATTER_REQ *pScatterReq;
int status = 0;
struct hif_scatter_req *pScatterReq;
int i, totalLength;
int pktsToScatter;
HTC_PACKET *pPacket;
A_BOOL asyncMode = (pSyncCompletionQueue == NULL) ? TRUE : FALSE;
struct htc_packet *pPacket;
bool asyncMode = (pSyncCompletionQueue == NULL) ? true : false;
int scatterSpaceRemaining = DEV_GET_MAX_BUNDLE_RECV_LENGTH(&target->Device);
pktsToScatter = HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue);
@ -1004,7 +1004,7 @@ static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target,
if ((HTC_PACKET_QUEUE_DEPTH(pRecvPktQueue) - pktsToScatter) > 0) {
/* we were forced to split this bundle receive operation
* all packets in this partial bundle must have their lookaheads ignored */
PartialBundle = TRUE;
PartialBundle = true;
/* this would only happen if the target ignored our max bundle limit */
AR_DEBUG_PRINTF(ATH_DEBUG_WARN,
("HTCIssueRecvPacketBundle : partial bundle detected num:%d , %d \n",
@ -1085,7 +1085,7 @@ static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target,
status = DevSubmitScatterRequest(&target->Device, pScatterReq, DEV_SCATTER_READ, asyncMode);
if (A_SUCCESS(status)) {
if (!status) {
*pNumPacketsFetched = i;
}
@ -1094,7 +1094,7 @@ static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target,
DEV_FREE_SCATTER_REQ(&target->Device, pScatterReq);
}
} while (FALSE);
} while (false);
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,("-HTCIssueRecvPacketBundle (status:%d) (fetched:%d) \n",
status,*pNumPacketsFetched));
@ -1102,7 +1102,7 @@ static A_STATUS HTCIssueRecvPacketBundle(HTC_TARGET *target,
return status;
}
static INLINE void CheckRecvWaterMark(HTC_ENDPOINT *pEndpoint)
static INLINE void CheckRecvWaterMark(struct htc_endpoint *pEndpoint)
{
/* see if endpoint is using a refill watermark
* ** no need to use a lock here, since we are only inspecting...
@ -1117,17 +1117,17 @@ static INLINE void CheckRecvWaterMark(HTC_ENDPOINT *pEndpoint)
}
/* callback when device layer or lookahead report parsing detects a pending message */
A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], int NumLookAheads, A_BOOL *pAsyncProc, int *pNumPktsFetched)
int HTCRecvMessagePendingHandler(void *Context, u32 MsgLookAheads[], int NumLookAheads, bool *pAsyncProc, int *pNumPktsFetched)
{
HTC_TARGET *target = (HTC_TARGET *)Context;
A_STATUS status = A_OK;
HTC_PACKET *pPacket;
HTC_ENDPOINT *pEndpoint;
A_BOOL asyncProc = FALSE;
A_UINT32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
struct htc_target *target = (struct htc_target *)Context;
int status = 0;
struct htc_packet *pPacket;
struct htc_endpoint *pEndpoint;
bool asyncProc = false;
u32 lookAheads[HTC_HOST_MAX_MSG_PER_BUNDLE];
int pktsFetched;
HTC_PACKET_QUEUE recvPktQueue, syncCompletedPktsQueue;
A_BOOL partialBundle;
struct htc_packet_queue recvPktQueue, syncCompletedPktsQueue;
bool partialBundle;
HTC_ENDPOINT_ID id;
int totalFetched = 0;
@ -1141,7 +1141,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
/* We use async mode to get the packets if the device layer supports it.
* The device layer interfaces with HIF in which HIF may have restrictions on
* how interrupts are processed */
asyncProc = TRUE;
asyncProc = true;
}
if (pAsyncProc != NULL) {
@ -1150,14 +1150,14 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
}
if (NumLookAheads > HTC_HOST_MAX_MSG_PER_BUNDLE) {
A_ASSERT(FALSE);
A_ASSERT(false);
return A_EPROTO;
}
/* on first entry copy the lookaheads into our temp array for processing */
A_MEMCPY(lookAheads, MsgLookAheads, (sizeof(A_UINT32)) * NumLookAheads);
memcpy(lookAheads, MsgLookAheads, (sizeof(u32)) * NumLookAheads);
while (TRUE) {
while (true) {
/* reset packets queues */
INIT_HTC_PACKET_QUEUE(&recvPktQueue);
@ -1165,12 +1165,12 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
if (NumLookAheads > HTC_HOST_MAX_MSG_PER_BUNDLE) {
status = A_EPROTO;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
/* first lookahead sets the expected endpoint IDs for all packets in a bundle */
id = ((HTC_FRAME_HDR *)&lookAheads[0])->EndpointID;
id = ((struct htc_frame_hdr *)&lookAheads[0])->EndpointID;
pEndpoint = &target->EndPoint[id];
if (id >= ENDPOINT_MAX) {
@ -1186,7 +1186,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
NumLookAheads,
pEndpoint,
&recvPktQueue);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -1200,7 +1200,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
/* we've got packet buffers for all we can currently fetch,
* this count is not valid anymore */
NumLookAheads = 0;
partialBundle = FALSE;
partialBundle = false;
/* now go fetch the list of HTC packets */
while (!HTC_QUEUE_EMPTY(&recvPktQueue)) {
@ -1214,14 +1214,14 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
asyncProc ? NULL : &syncCompletedPktsQueue,
&pktsFetched,
partialBundle);
if (A_FAILED(status)) {
if (status) {
break;
}
if (HTC_PACKET_QUEUE_DEPTH(&recvPktQueue) != 0) {
/* we couldn't fetch all packets at one time, this creates a broken
* bundle */
partialBundle = TRUE;
partialBundle = true;
}
}
@ -1248,7 +1248,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
/* go fetch the packet */
status = HTCIssueRecv(target, pPacket);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -1261,7 +1261,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
}
if (A_SUCCESS(status)) {
if (!status) {
CheckRecvWaterMark(pEndpoint);
}
@ -1283,7 +1283,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
/* unload sync completion queue */
while (!HTC_QUEUE_EMPTY(&syncCompletedPktsQueue)) {
HTC_PACKET_QUEUE container;
struct htc_packet_queue container;
pPacket = HTC_PACKET_DEQUEUE(&syncCompletedPktsQueue);
A_ASSERT(pPacket != NULL);
@ -1295,7 +1295,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
/* process header for each of the recv packets
* note: the lookahead of the last packet is useful for us to continue in this loop */
status = HTCProcessRecvHeader(target,pPacket,lookAheads,&NumLookAheads);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -1317,7 +1317,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
DO_RCV_COMPLETION(pEndpoint,&container);
}
if (A_FAILED(status)) {
if (status) {
break;
}
@ -1346,7 +1346,7 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
REF_IRQ_STATUS_RECHECK(&target->Device);
}
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Failed to get pending recv messages (%d) \n",status));
/* cleanup any packets we allocated but didn't use to actually fetch any packets */
@ -1385,18 +1385,18 @@ A_STATUS HTCRecvMessagePendingHandler(void *Context, A_UINT32 MsgLookAheads[], i
return status;
}
A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue)
int HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
A_BOOL unblockRecv = FALSE;
A_STATUS status = A_OK;
HTC_PACKET *pFirstPacket;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint;
bool unblockRecv = false;
int status = 0;
struct htc_packet *pFirstPacket;
pFirstPacket = HTC_GET_PKT_AT_HEAD(pPktQueue);
if (NULL == pFirstPacket) {
A_ASSERT(FALSE);
A_ASSERT(false);
return A_EINVAL;
}
@ -1415,7 +1415,7 @@ A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQu
LOCK_HTC_RX(target);
if (HTC_STOPPING(target)) {
HTC_PACKET *pPacket;
struct htc_packet *pPacket;
UNLOCK_HTC_RX(target);
@ -1438,7 +1438,7 @@ A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQu
target->EpWaitingForBuffers));
target->RecvStateFlags &= ~HTC_RECV_WAIT_BUFFERS;
target->EpWaitingForBuffers = ENDPOINT_MAX;
unblockRecv = TRUE;
unblockRecv = true;
}
}
@ -1449,23 +1449,23 @@ A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQu
DevEnableRecv(&target->Device,DEV_ENABLE_RECV_SYNC);
}
} while (FALSE);
} while (false);
return status;
}
/* Makes a buffer available to the HTC module */
A_STATUS HTCAddReceivePkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
int HTCAddReceivePkt(HTC_HANDLE HTCHandle, struct htc_packet *pPacket)
{
HTC_PACKET_QUEUE queue;
struct htc_packet_queue queue;
INIT_HTC_PACKET_QUEUE_AND_ADD(&queue,pPacket);
return HTCAddReceivePktMultiple(HTCHandle, &queue);
}
void HTCUnblockRecv(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_BOOL unblockRecv = FALSE;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
bool unblockRecv = false;
LOCK_HTC_RX(target);
@ -1475,7 +1475,7 @@ void HTCUnblockRecv(HTC_HANDLE HTCHandle)
target->EpWaitingForBuffers));
target->RecvStateFlags &= ~HTC_RECV_WAIT_BUFFERS;
target->EpWaitingForBuffers = ENDPOINT_MAX;
unblockRecv = TRUE;
unblockRecv = true;
}
UNLOCK_HTC_RX(target);
@ -1486,10 +1486,10 @@ void HTCUnblockRecv(HTC_HANDLE HTCHandle)
}
}
static void HTCFlushRxQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PACKET_QUEUE *pQueue)
static void HTCFlushRxQueue(struct htc_target *target, struct htc_endpoint *pEndpoint, struct htc_packet_queue *pQueue)
{
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE container;
struct htc_packet *pPacket;
struct htc_packet_queue container;
LOCK_HTC_RX(target);
@ -1512,7 +1512,7 @@ static void HTCFlushRxQueue(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PAC
UNLOCK_HTC_RX(target);
}
static void HTCFlushEndpointRX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint)
static void HTCFlushEndpointRX(struct htc_target *target, struct htc_endpoint *pEndpoint)
{
/* flush any recv indications not already made */
HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RecvIndicationQueue);
@ -1520,9 +1520,9 @@ static void HTCFlushEndpointRX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint)
HTCFlushRxQueue(target,pEndpoint,&pEndpoint->RxBuffers);
}
void HTCFlushRecvBuffers(HTC_TARGET *target)
void HTCFlushRecvBuffers(struct htc_target *target)
{
HTC_ENDPOINT *pEndpoint;
struct htc_endpoint *pEndpoint;
int i;
for (i = ENDPOINT_0; i < ENDPOINT_MAX; i++) {
@ -1538,7 +1538,7 @@ void HTCFlushRecvBuffers(HTC_TARGET *target)
void HTCEnableRecv(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
if (!HTC_STOPPING(target)) {
/* re-enable */
@ -1548,7 +1548,7 @@ void HTCEnableRecv(HTC_HANDLE HTCHandle)
void HTCDisableRecv(HTC_HANDLE HTCHandle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
if (!HTC_STOPPING(target)) {
/* disable */
@ -1559,16 +1559,16 @@ void HTCDisableRecv(HTC_HANDLE HTCHandle)
int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
return HTC_PACKET_QUEUE_DEPTH(&(target->EndPoint[Endpoint].RxBuffers));
}
A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
A_UINT32 TimeoutInMs,
A_BOOL *pbIsRecvPending)
int HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
u32 TimeoutInMs,
bool *pbIsRecvPending)
{
A_STATUS status = A_OK;
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int status = 0;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
status = DevWaitForPendingRecv(&target->Device,
TimeoutInMs,

View File

@ -43,8 +43,8 @@ typedef enum _HTC_SEND_QUEUE_RESULT {
(reason)); \
}
static void DoSendCompletion(HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pQueueToIndicate)
static void DoSendCompletion(struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueueToIndicate)
{
do {
@ -62,7 +62,7 @@ static void DoSendCompletion(HTC_ENDPOINT *pEndpoint,
/* all packets are now owned by the callback, reset queue to be safe */
INIT_HTC_PACKET_QUEUE(pQueueToIndicate);
} else {
HTC_PACKET *pPacket;
struct htc_packet *pPacket;
/* using legacy EpTxComplete */
do {
pPacket = HTC_PACKET_DEQUEUE(pQueueToIndicate);
@ -72,16 +72,16 @@ static void DoSendCompletion(HTC_ENDPOINT *pEndpoint,
} while (!HTC_QUEUE_EMPTY(pQueueToIndicate));
}
} while (FALSE);
} while (false);
}
/* do final completion on sent packet */
static INLINE void CompleteSentPacket(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_PACKET *pPacket)
static INLINE void CompleteSentPacket(struct htc_target *target, struct htc_endpoint *pEndpoint, struct htc_packet *pPacket)
{
pPacket->Completion = NULL;
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("CompleteSentPacket: request failed (status:%d, ep:%d, length:%d creds:%d) \n",
pPacket->Status, pPacket->Endpoint, pPacket->ActualLength, pPacket->PktInfo.AsTx.CreditsUsed));
@ -101,11 +101,11 @@ static INLINE void CompleteSentPacket(HTC_TARGET *target, HTC_ENDPOINT *pEndpoin
/* our internal send packet completion handler when packets are submited to the AR6K device
* layer */
static void HTCSendPktCompletionHandler(void *Context, HTC_PACKET *pPacket)
static void HTCSendPktCompletionHandler(void *Context, struct htc_packet *pPacket)
{
HTC_TARGET *target = (HTC_TARGET *)Context;
HTC_ENDPOINT *pEndpoint = &target->EndPoint[pPacket->Endpoint];
HTC_PACKET_QUEUE container;
struct htc_target *target = (struct htc_target *)Context;
struct htc_endpoint *pEndpoint = &target->EndPoint[pPacket->Endpoint];
struct htc_packet_queue container;
CompleteSentPacket(target,pEndpoint,pPacket);
INIT_HTC_PACKET_QUEUE_AND_ADD(&container,pPacket);
@ -113,19 +113,19 @@ static void HTCSendPktCompletionHandler(void *Context, HTC_PACKET *pPacket)
DO_EP_TX_COMPLETION(pEndpoint,&container);
}
A_STATUS HTCIssueSend(HTC_TARGET *target, HTC_PACKET *pPacket)
int HTCIssueSend(struct htc_target *target, struct htc_packet *pPacket)
{
A_STATUS status;
A_BOOL sync = FALSE;
int status;
bool sync = false;
if (pPacket->Completion == NULL) {
/* mark that this request was synchronously issued */
sync = TRUE;
sync = true;
}
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
("+-HTCIssueSend: transmit length : %d (%s) \n",
pPacket->ActualLength + (A_UINT32)HTC_HDR_LENGTH,
pPacket->ActualLength + (u32)HTC_HDR_LENGTH,
sync ? "SYNC" : "ASYNC" ));
/* send message to device */
@ -146,21 +146,21 @@ A_STATUS HTCIssueSend(HTC_TARGET *target, HTC_PACKET *pPacket)
}
/* get HTC send packets from the TX queue on an endpoint */
static INLINE void GetHTCSendPackets(HTC_TARGET *target,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pQueue)
static INLINE void GetHTCSendPackets(struct htc_target *target,
struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueue)
{
int creditsRequired;
int remainder;
A_UINT8 sendFlags;
HTC_PACKET *pPacket;
u8 sendFlags;
struct htc_packet *pPacket;
unsigned int transferLength;
/****** NOTE : the TX lock is held when this function is called *****************/
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("+GetHTCSendPackets \n"));
/* loop until we can grab as many packets out of the queue as we can */
while (TRUE) {
while (true) {
sendFlags = 0;
/* get packet at head, but don't remove it */
@ -264,14 +264,14 @@ static INLINE void GetHTCSendPackets(HTC_TARGET *target,
}
static void HTCAsyncSendScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
static void HTCAsyncSendScatterCompletion(struct hif_scatter_req *pScatterReq)
{
int i;
HTC_PACKET *pPacket;
HTC_ENDPOINT *pEndpoint = (HTC_ENDPOINT *)pScatterReq->Context;
HTC_TARGET *target = (HTC_TARGET *)pEndpoint->target;
A_STATUS status = A_OK;
HTC_PACKET_QUEUE sendCompletes;
struct htc_packet *pPacket;
struct htc_endpoint *pEndpoint = (struct htc_endpoint *)pScatterReq->Context;
struct htc_target *target = (struct htc_target *)pEndpoint->target;
int status = 0;
struct htc_packet_queue sendCompletes;
INIT_HTC_PACKET_QUEUE(&sendCompletes);
@ -280,14 +280,14 @@ static void HTCAsyncSendScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
DEV_FINISH_SCATTER_OPERATION(pScatterReq);
if (A_FAILED(pScatterReq->CompletionStatus)) {
if (pScatterReq->CompletionStatus) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("** Send Scatter Request Failed: %d \n",pScatterReq->CompletionStatus));
status = A_ERROR;
}
/* walk through the scatter list and process */
for (i = 0; i < pScatterReq->ValidScatterEntries; i++) {
pPacket = (HTC_PACKET *)(pScatterReq->ScatterList[i].pCallerContexts[0]);
pPacket = (struct htc_packet *)(pScatterReq->ScatterList[i].pCallerContexts[0]);
A_ASSERT(pPacket != NULL);
pPacket->Status = status;
CompleteSentPacket(target,pEndpoint,pPacket);
@ -309,21 +309,21 @@ static void HTCAsyncSendScatterCompletion(HIF_SCATTER_REQ *pScatterReq)
* - a message that will consume a partial credit will stop the bundling process early
* - we drop below the minimum number of messages for a bundle
* */
static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pQueue,
static void HTCIssueSendBundle(struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pQueue,
int *pBundlesSent,
int *pTotalBundlesPkts)
{
int pktsToScatter;
unsigned int scatterSpaceRemaining;
HIF_SCATTER_REQ *pScatterReq = NULL;
struct hif_scatter_req *pScatterReq = NULL;
int i, packetsInScatterReq;
unsigned int transferLength;
HTC_PACKET *pPacket;
A_BOOL done = FALSE;
struct htc_packet *pPacket;
bool done = false;
int bundlesSent = 0;
int totalPktsInBundle = 0;
HTC_TARGET *target = pEndpoint->target;
struct htc_target *target = pEndpoint->target;
int creditRemainder = 0;
int creditPad;
@ -361,7 +361,7 @@ static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint,
pPacket = HTC_GET_PKT_AT_HEAD(pQueue);
if (pPacket == NULL) {
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -400,7 +400,7 @@ static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint,
if (NULL == pPacket) {
/* can't bundle */
done = TRUE;
done = true;
break;
}
@ -450,7 +450,7 @@ static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint,
if (packetsInScatterReq > 0) {
/* work backwards to requeue requests */
for (i = (packetsInScatterReq - 1); i >= 0; i--) {
pPacket = (HTC_PACKET *)(pScatterReq->ScatterList[i].pCallerContexts[0]);
pPacket = (struct htc_packet *)(pScatterReq->ScatterList[i].pCallerContexts[0]);
if (pPacket != NULL) {
/* undo any prep */
HTC_UNPREPARE_SEND_PKT(pPacket);
@ -477,12 +477,12 @@ static void HTCIssueSendBundle(HTC_ENDPOINT *pEndpoint,
/*
* if there are no credits, the packet(s) remains in the queue.
* this function returns the result of the attempt to send a queue of HTC packets */
static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
HTC_ENDPOINT *pEndpoint,
HTC_PACKET_QUEUE *pCallersSendQueue)
static HTC_SEND_QUEUE_RESULT HTCTrySend(struct htc_target *target,
struct htc_endpoint *pEndpoint,
struct htc_packet_queue *pCallersSendQueue)
{
HTC_PACKET_QUEUE sendQueue; /* temp queue to hold packets at various stages */
HTC_PACKET *pPacket;
struct htc_packet_queue sendQueue; /* temp queue to hold packets at various stages */
struct htc_packet *pPacket;
int bundlesSent;
int pktsInBundles;
int overflow;
@ -546,7 +546,7 @@ static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
/* the caller's queue has all the packets that won't fit*/
/* walk through the caller's queue and indicate each one to the send full handler */
ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->QueueHead, pPacket, HTC_PACKET, ListLink) {
ITERATE_OVER_LIST_ALLOW_REMOVE(&pCallersSendQueue->QueueHead, pPacket, struct htc_packet, ListLink) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Indicating overflowed TX packet: 0x%lX \n",
(unsigned long)pPacket));
@ -571,7 +571,7 @@ static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
}
}
} while (FALSE);
} while (false);
if (result != HTC_SEND_QUEUE_OK) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,("-HTCTrySend: \n"));
@ -602,7 +602,7 @@ static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
/* now drain the endpoint TX queue for transmission as long as we have enough
* credits */
while (TRUE) {
while (true) {
if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) == 0) {
break;
@ -623,7 +623,7 @@ static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
bundlesSent = 0;
pktsInBundles = 0;
while (TRUE) {
while (true) {
/* try to send a bundle on each pass */
if ((target->SendBundlingEnabled) &&
@ -668,11 +668,11 @@ static HTC_SEND_QUEUE_RESULT HTCTrySend(HTC_TARGET *target,
return HTC_SEND_QUEUE_OK;
}
A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue)
int HTCSendPktsMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint;
HTC_PACKET *pPacket;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint;
struct htc_packet *pPacket;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCSendPktsMultiple: Queue: 0x%lX, Pkts %d \n",
(unsigned long)pPktQueue, HTC_PACKET_QUEUE_DEPTH(pPktQueue)));
@ -705,13 +705,13 @@ A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue)
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-HTCSendPktsMultiple \n"));
return A_OK;
return 0;
}
/* HTC API - HTCSendPkt */
A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
int HTCSendPkt(HTC_HANDLE HTCHandle, struct htc_packet *pPacket)
{
HTC_PACKET_QUEUE queue;
struct htc_packet_queue queue;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
("+-HTCSendPkt: Enter endPointId: %d, buffer: 0x%lX, length: %d \n",
@ -721,10 +721,10 @@ A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket)
}
/* check TX queues to drain because of credit distribution update */
static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target)
static INLINE void HTCCheckEndpointTxQueues(struct htc_target *target)
{
HTC_ENDPOINT *pEndpoint;
HTC_ENDPOINT_CREDIT_DIST *pDistItem;
struct htc_endpoint *pEndpoint;
struct htc_endpoint_credit_dist *pDistItem;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCCheckEndpointTxQueues \n"));
pDistItem = target->EpCreditDistributionListHead;
@ -734,7 +734,7 @@ static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target)
* NOTE: no locks need to be taken since the distribution list
* is not dynamic (cannot be re-ordered) and we are not modifying any state */
while (pDistItem != NULL) {
pEndpoint = (HTC_ENDPOINT *)pDistItem->pHTCReserved;
pEndpoint = (struct htc_endpoint *)pDistItem->pHTCReserved;
if (HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue) > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, (" Ep %d has %d credits and %d Packets in TX Queue \n",
@ -753,12 +753,12 @@ static INLINE void HTCCheckEndpointTxQueues(HTC_TARGET *target)
}
/* process credit reports and call distribution function */
void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint)
void HTCProcessCreditRpt(struct htc_target *target, HTC_CREDIT_REPORT *pRpt, int NumEntries, HTC_ENDPOINT_ID FromEndpoint)
{
int i;
HTC_ENDPOINT *pEndpoint;
struct htc_endpoint *pEndpoint;
int totalCredits = 0;
A_BOOL doDist = FALSE;
bool doDist = false;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+HTCProcessCreditRpt, Credit Report Entries:%d \n", NumEntries));
@ -767,7 +767,7 @@ void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEnt
for (i = 0; i < NumEntries; i++, pRpt++) {
if (pRpt->EndpointID >= ENDPOINT_MAX) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
@ -807,7 +807,7 @@ void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEnt
* will handle giving out credits back to the endpoints */
pEndpoint->CreditDist.TxCreditsToDist += pRpt->Credits;
/* flag that we have to do the distribution */
doDist = TRUE;
doDist = true;
}
/* refresh tx depth for distribution function that will recover these credits
@ -838,11 +838,11 @@ void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEnt
}
/* flush endpoint TX queue */
static void HTCFlushEndpointTX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_TX_TAG Tag)
static void HTCFlushEndpointTX(struct htc_target *target, struct htc_endpoint *pEndpoint, HTC_TX_TAG Tag)
{
HTC_PACKET *pPacket;
HTC_PACKET_QUEUE discardQueue;
HTC_PACKET_QUEUE container;
struct htc_packet *pPacket;
struct htc_packet_queue discardQueue;
struct htc_packet_queue container;
/* initialize the discard queue */
INIT_HTC_PACKET_QUEUE(&discardQueue);
@ -850,7 +850,7 @@ static void HTCFlushEndpointTX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_
LOCK_HTC_TX(target);
/* interate from the front of the TX queue and flush out packets */
ITERATE_OVER_LIST_ALLOW_REMOVE(&pEndpoint->TxQueue.QueueHead, pPacket, HTC_PACKET, ListLink) {
ITERATE_OVER_LIST_ALLOW_REMOVE(&pEndpoint->TxQueue.QueueHead, pPacket, struct htc_packet, ListLink) {
/* check for removal */
if ((HTC_TX_PACKET_TAG_ALL == Tag) || (Tag == pPacket->PktInfo.AsTx.Tag)) {
@ -879,7 +879,7 @@ static void HTCFlushEndpointTX(HTC_TARGET *target, HTC_ENDPOINT *pEndpoint, HTC_
}
void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist)
void DumpCreditDist(struct htc_endpoint_credit_dist *pEPDist)
{
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("--- EP : %d ServiceID: 0x%X --------------\n",
pEPDist->Endpoint, pEPDist->ServiceID));
@ -895,13 +895,13 @@ void DumpCreditDist(HTC_ENDPOINT_CREDIT_DIST *pEPDist)
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsPerMaxMsg : %d \n", pEPDist->TxCreditsPerMaxMsg));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxCreditsToDist : %d \n", pEPDist->TxCreditsToDist));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, (" TxQueueDepth : %d \n",
HTC_PACKET_QUEUE_DEPTH(&((HTC_ENDPOINT *)pEPDist->pHTCReserved)->TxQueue)));
HTC_PACKET_QUEUE_DEPTH(&((struct htc_endpoint *)pEPDist->pHTCReserved)->TxQueue)));
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, ("----------------------------------------------------\n"));
}
void DumpCreditDistStates(HTC_TARGET *target)
void DumpCreditDistStates(struct htc_target *target)
{
HTC_ENDPOINT_CREDIT_DIST *pEPList = target->EpCreditDistributionListHead;
struct htc_endpoint_credit_dist *pEPList = target->EpCreditDistributionListHead;
while (pEPList != NULL) {
DumpCreditDist(pEPList);
@ -917,9 +917,9 @@ void DumpCreditDistStates(HTC_TARGET *target)
}
/* flush all send packets from all endpoint queues */
void HTCFlushSendPkts(HTC_TARGET *target)
void HTCFlushSendPkts(struct htc_target *target)
{
HTC_ENDPOINT *pEndpoint;
struct htc_endpoint *pEndpoint;
int i;
if (AR_DEBUG_LVL_CHECK(ATH_DEBUG_TRC)) {
@ -941,11 +941,11 @@ void HTCFlushSendPkts(HTC_TARGET *target)
/* HTC API to flush an endpoint's TX queue*/
void HTCFlushEndpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG Tag)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint];
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
if (pEndpoint->ServiceID == 0) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
/* not in use.. */
return;
}
@ -956,14 +956,14 @@ void HTCFlushEndpoint(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint, HTC_TX_TAG
/* HTC API to indicate activity to the credit distribution function */
void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
A_BOOL Active)
bool Active)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint];
A_BOOL doDist = FALSE;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
bool doDist = false;
if (pEndpoint->ServiceID == 0) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
/* not in use.. */
return;
}
@ -974,13 +974,13 @@ void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
if (!(pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE)) {
/* mark active now */
pEndpoint->CreditDist.DistFlags |= HTC_EP_ACTIVE;
doDist = TRUE;
doDist = true;
}
} else {
if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) {
/* mark inactive now */
pEndpoint->CreditDist.DistFlags &= ~HTC_EP_ACTIVE;
doDist = TRUE;
doDist = true;
}
}
@ -1005,19 +1005,19 @@ void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
}
}
A_BOOL HTCIsEndpointActive(HTC_HANDLE HTCHandle,
bool HTCIsEndpointActive(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
HTC_ENDPOINT *pEndpoint = &target->EndPoint[Endpoint];
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_endpoint *pEndpoint = &target->EndPoint[Endpoint];
if (pEndpoint->ServiceID == 0) {
return FALSE;
return false;
}
if (pEndpoint->CreditDist.DistFlags & HTC_EP_ACTIVE) {
return TRUE;
return true;
}
return FALSE;
return false;
}

View File

@ -22,21 +22,21 @@
//==============================================================================
#include "htc_internal.h"
void HTCControlTxComplete(void *Context, HTC_PACKET *pPacket)
void HTCControlTxComplete(void *Context, struct htc_packet *pPacket)
{
/* not implemented
* we do not send control TX frames during normal runtime, only during setup */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
}
/* callback when a control message arrives on this endpoint */
void HTCControlRecv(void *Context, HTC_PACKET *pPacket)
void HTCControlRecv(void *Context, struct htc_packet *pPacket)
{
AR_DEBUG_ASSERT(pPacket->Endpoint == ENDPOINT_0);
if (pPacket->Status == A_ECANCELED) {
/* this is a flush operation, return the control packet back to the pool */
HTC_FREE_CONTROL_RX((HTC_TARGET*)Context,pPacket);
HTC_FREE_CONTROL_RX((struct htc_target*)Context,pPacket);
return;
}
@ -44,7 +44,7 @@ void HTCControlRecv(void *Context, HTC_PACKET *pPacket)
if (pPacket->ActualLength > 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("HTCControlRecv, got message with length:%d \n",
pPacket->ActualLength + (A_UINT32)HTC_HDR_LENGTH));
pPacket->ActualLength + (u32)HTC_HDR_LENGTH));
#ifdef ATH_DEBUG_MODULE
/* dump header and message */
@ -54,13 +54,13 @@ void HTCControlRecv(void *Context, HTC_PACKET *pPacket)
#endif
}
HTC_RECYCLE_RX_PKT((HTC_TARGET*)Context,pPacket,&((HTC_TARGET*)Context)->EndPoint[0]);
HTC_RECYCLE_RX_PKT((struct htc_target*)Context,pPacket,&((struct htc_target*)Context)->EndPoint[0]);
}
A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
int HTCSendSetupComplete(struct htc_target *target)
{
HTC_PACKET *pSendPacket = NULL;
A_STATUS status;
struct htc_packet *pSendPacket = NULL;
int status;
do {
/* allocate a packet to send to the target */
@ -73,7 +73,7 @@ A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
if (target->HTCTargetVersion >= HTC_VERSION_2P1) {
HTC_SETUP_COMPLETE_EX_MSG *pSetupCompleteEx;
A_UINT32 setupFlags = 0;
u32 setupFlags = 0;
pSetupCompleteEx = (HTC_SETUP_COMPLETE_EX_MSG *)pSendPacket->pBuffer;
A_MEMZERO(pSetupCompleteEx, sizeof(HTC_SETUP_COMPLETE_EX_MSG));
@ -83,10 +83,10 @@ A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
setupFlags |= HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV;
pSetupCompleteEx->MaxMsgsPerBundledRecv = target->MaxMsgPerBundle;
}
A_MEMCPY(&pSetupCompleteEx->SetupFlags, &setupFlags, sizeof(pSetupCompleteEx->SetupFlags));
memcpy(&pSetupCompleteEx->SetupFlags, &setupFlags, sizeof(pSetupCompleteEx->SetupFlags));
SET_HTC_PACKET_INFO_TX(pSendPacket,
NULL,
(A_UINT8 *)pSetupCompleteEx,
(u8 *)pSetupCompleteEx,
sizeof(HTC_SETUP_COMPLETE_EX_MSG),
ENDPOINT_0,
HTC_SERVICE_TX_PACKET_TAG);
@ -99,7 +99,7 @@ A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
pSetupComplete->MessageID = HTC_MSG_SETUP_COMPLETE_ID;
SET_HTC_PACKET_INFO_TX(pSendPacket,
NULL,
(A_UINT8 *)pSetupComplete,
(u8 *)pSetupComplete,
sizeof(HTC_SETUP_COMPLETE_MSG),
ENDPOINT_0,
HTC_SERVICE_TX_PACKET_TAG);
@ -111,7 +111,7 @@ A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
/* send the message */
status = HTCIssueSend(target,pSendPacket);
} while (FALSE);
} while (false);
if (pSendPacket != NULL) {
HTC_FREE_CONTROL_TX(target,pSendPacket);
@ -121,18 +121,18 @@ A_STATUS HTCSendSetupComplete(HTC_TARGET *target)
}
A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
HTC_SERVICE_CONNECT_REQ *pConnectReq,
HTC_SERVICE_CONNECT_RESP *pConnectResp)
int HTCConnectService(HTC_HANDLE HTCHandle,
struct htc_service_connect_req *pConnectReq,
struct htc_service_connect_resp *pConnectResp)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
A_STATUS status = A_OK;
HTC_PACKET *pRecvPacket = NULL;
HTC_PACKET *pSendPacket = NULL;
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int status = 0;
struct htc_packet *pRecvPacket = NULL;
struct htc_packet *pSendPacket = NULL;
HTC_CONNECT_SERVICE_RESPONSE_MSG *pResponseMsg;
HTC_CONNECT_SERVICE_MSG *pConnectMsg;
HTC_ENDPOINT_ID assignedEndpoint = ENDPOINT_MAX;
HTC_ENDPOINT *pEndpoint;
struct htc_endpoint *pEndpoint;
unsigned int maxMsgSize = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("+HTCConnectService, target:0x%lX SvcID:0x%X \n",
@ -151,7 +151,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
pSendPacket = HTC_ALLOC_CONTROL_TX(target);
if (NULL == pSendPacket) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_NO_MEMORY;
break;
}
@ -166,7 +166,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
if ((pConnectReq->pMetaData != NULL) &&
(pConnectReq->MetaDataLength <= HTC_SERVICE_META_DATA_MAX_LENGTH)) {
/* copy meta data into message buffer (after header ) */
A_MEMCPY((A_UINT8 *)pConnectMsg + sizeof(HTC_CONNECT_SERVICE_MSG),
memcpy((u8 *)pConnectMsg + sizeof(HTC_CONNECT_SERVICE_MSG),
pConnectReq->pMetaData,
pConnectReq->MetaDataLength);
pConnectMsg->ServiceMetaLength = pConnectReq->MetaDataLength;
@ -174,7 +174,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
SET_HTC_PACKET_INFO_TX(pSendPacket,
NULL,
(A_UINT8 *)pConnectMsg,
(u8 *)pConnectMsg,
sizeof(HTC_CONNECT_SERVICE_MSG) + pConnectMsg->ServiceMetaLength,
ENDPOINT_0,
HTC_SERVICE_TX_PACKET_TAG);
@ -184,14 +184,14 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
HTC_PREPARE_SEND_PKT(pSendPacket,0,0,0);
status = HTCIssueSend(target,pSendPacket);
if (A_FAILED(status)) {
if (status) {
break;
}
/* wait for response */
status = HTCWaitforControlMessage(target, &pRecvPacket);
if (A_FAILED(status)) {
if (status) {
break;
}
/* we controlled the buffer creation so it has to be properly aligned */
@ -200,7 +200,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
if ((pResponseMsg->MessageID != HTC_MSG_CONNECT_SERVICE_RESPONSE_ID) ||
(pRecvPacket->ActualLength < sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG))) {
/* this message is not valid */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
status = A_EPROTO;
break;
}
@ -224,8 +224,8 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
/* caller supplied a buffer and the target responded with data */
int copyLength = min((int)pConnectResp->BufferLength, (int)pResponseMsg->ServiceMetaLength);
/* copy the meta data */
A_MEMCPY(pConnectResp->pMetaData,
((A_UINT8 *)pResponseMsg) + sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG),
memcpy(pConnectResp->pMetaData,
((u8 *)pResponseMsg) + sizeof(HTC_CONNECT_SERVICE_RESPONSE_MSG),
copyLength);
pConnectResp->ActualLength = copyLength;
}
@ -236,12 +236,12 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
status = A_EPROTO;
if (assignedEndpoint >= ENDPOINT_MAX) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
if (0 == maxMsgSize) {
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
@ -249,7 +249,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
pEndpoint->Id = assignedEndpoint;
if (pEndpoint->ServiceID != 0) {
/* endpoint already in use! */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
@ -275,7 +275,7 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
* since the host will actually issue smaller messages in the Send path */
if (pConnectReq->MaxSendMsgSize > maxMsgSize) {
/* can't be larger than the maximum the target can support */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
pEndpoint->CreditDist.TxCreditsPerMaxMsg = pConnectReq->MaxSendMsgSize / target->TargetCreditSize;
@ -290,9 +290,9 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
/* save local connection flags */
pEndpoint->LocalConnectionFlags = pConnectReq->LocalConnectionFlags;
status = A_OK;
status = 0;
} while (FALSE);
} while (false);
if (pSendPacket != NULL) {
HTC_FREE_CONTROL_TX(target,pSendPacket);
@ -307,9 +307,9 @@ A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
return status;
}
static void AddToEndpointDistList(HTC_TARGET *target, HTC_ENDPOINT_CREDIT_DIST *pEpDist)
static void AddToEndpointDistList(struct htc_target *target, struct htc_endpoint_credit_dist *pEpDist)
{
HTC_ENDPOINT_CREDIT_DIST *pCurEntry,*pLastEntry;
struct htc_endpoint_credit_dist *pCurEntry,*pLastEntry;
if (NULL == target->EpCreditDistributionListHead) {
target->EpCreditDistributionListHead = pEpDist;
@ -336,10 +336,10 @@ static void AddToEndpointDistList(HTC_TARGET *target, HTC_ENDPOINT_CREDIT_DIST *
/* default credit init callback */
static void HTCDefaultCreditInit(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 totalEps = 0;
int creditsPerEndpoint;
@ -360,7 +360,7 @@ static void HTCDefaultCreditInit(void *Context,
if (creditsPerEndpoint < pCurEpDist->TxCreditsPerMaxMsg) {
/* too many endpoints and not enough credits */
AR_DEBUG_ASSERT(FALSE);
AR_DEBUG_ASSERT(false);
break;
}
/* our minimum is set for at least 1 max message */
@ -379,10 +379,10 @@ static void HTCDefaultCreditInit(void *Context,
/* default credit distribution callback, NOTE, this callback holds the TX lock */
void HTCDefaultCreditDist(void *Context,
HTC_ENDPOINT_CREDIT_DIST *pEPDistList,
struct htc_endpoint_credit_dist *pEPDistList,
HTC_CREDIT_DIST_REASON Reason)
{
HTC_ENDPOINT_CREDIT_DIST *pCurEpDist;
struct htc_endpoint_credit_dist *pCurEpDist;
if (Reason == HTC_CREDIT_DIST_SEND_COMPLETE) {
pCurEpDist = pEPDistList;
@ -408,7 +408,7 @@ void HTCSetCreditDistribution(HTC_HANDLE HTCHandle,
HTC_SERVICE_ID ServicePriorityOrder[],
int ListLength)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
struct htc_target *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);
int i;
int ep;

View File

@ -57,7 +57,7 @@ extern "C" {
/* macro to make a module-specific masks */
#define ATH_DEBUG_MAKE_MODULE_MASK(index) (1 << (ATH_DEBUG_MODULE_MASK_SHIFT + (index)))
void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription);
void DebugDumpBytes(u8 *buffer, u16 length, char *pDescription);
/* Debug support on a per-module basis
*
@ -95,7 +95,7 @@ void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription);
* #define ATH_DEBUG_BMI ATH_DEBUG_MAKE_MODULE_MASK(0)
*
* #ifdef DEBUG
* static ATH_DEBUG_MASK_DESCRIPTION bmi_debug_desc[] = {
* static struct ath_debug_mask_description bmi_debug_desc[] = {
* { ATH_DEBUG_BMI , "BMI Tracing"}, <== description of the module specific mask
* };
*
@ -118,24 +118,24 @@ void DebugDumpBytes(A_UCHAR *buffer, A_UINT16 length, char *pDescription);
#define ATH_DEBUG_MAX_MASK_DESC_LENGTH 32
#define ATH_DEBUG_MAX_MOD_DESC_LENGTH 64
typedef struct {
A_UINT32 Mask;
A_CHAR Description[ATH_DEBUG_MAX_MASK_DESC_LENGTH];
} ATH_DEBUG_MASK_DESCRIPTION;
struct ath_debug_mask_description {
u32 Mask;
char Description[ATH_DEBUG_MAX_MASK_DESC_LENGTH];
};
#define ATH_DEBUG_INFO_FLAGS_REGISTERED (1 << 0)
typedef struct _ATH_DEBUG_MODULE_DBG_INFO{
struct _ATH_DEBUG_MODULE_DBG_INFO *pNext;
A_CHAR ModuleName[16];
A_CHAR ModuleDescription[ATH_DEBUG_MAX_MOD_DESC_LENGTH];
A_UINT32 Flags;
A_UINT32 CurrentMask;
char ModuleName[16];
char ModuleDescription[ATH_DEBUG_MAX_MOD_DESC_LENGTH];
u32 Flags;
u32 CurrentMask;
int MaxDescriptions;
ATH_DEBUG_MASK_DESCRIPTION *pMaskDescriptions; /* pointer to array of descriptions */
struct ath_debug_mask_description *pMaskDescriptions; /* pointer to array of descriptions */
} ATH_DEBUG_MODULE_DBG_INFO;
#define ATH_DEBUG_DESCRIPTION_COUNT(d) (int)((sizeof((d))) / (sizeof(ATH_DEBUG_MASK_DESCRIPTION)))
#define ATH_DEBUG_DESCRIPTION_COUNT(d) (int)((sizeof((d))) / (sizeof(struct ath_debug_mask_description)))
#define GET_ATH_MODULE_DEBUG_VAR_NAME(s) _XGET_ATH_MODULE_NAME_DEBUG_(s)
#define GET_ATH_MODULE_DEBUG_VAR_MASK(s) _XGET_ATH_MODULE_NAME_DEBUG_(s).CurrentMask
@ -181,9 +181,9 @@ void a_register_module_debug_info(ATH_DEBUG_MODULE_DBG_INFO *pInfo);
#endif
A_STATUS a_get_module_mask(A_CHAR *module_name, A_UINT32 *pMask);
A_STATUS a_set_module_mask(A_CHAR *module_name, A_UINT32 Mask);
void a_dump_module_debug_info_by_name(A_CHAR *module_name);
int a_get_module_mask(char *module_name, u32 *pMask);
int a_set_module_mask(char *module_name, u32 Mask);
void a_dump_module_debug_info_by_name(char *module_name);
void a_module_debug_support_init(void);
void a_module_debug_support_cleanup(void);

View File

@ -188,10 +188,10 @@ extern "C" {
ar6000_dbglog_event((ar), (dropped), (buffer), (length));
#define A_WMI_STREAM_TX_ACTIVE(devt,trafficClass) \
ar6000_indicate_tx_activity((devt),(trafficClass), TRUE)
ar6000_indicate_tx_activity((devt),(trafficClass), true)
#define A_WMI_STREAM_TX_INACTIVE(devt,trafficClass) \
ar6000_indicate_tx_activity((devt),(trafficClass), FALSE)
ar6000_indicate_tx_activity((devt),(trafficClass), false)
#define A_WMI_Ac2EndpointID(devht, ac)\
ar6000_ac2_endpoint_id((devht), (ac))

View File

@ -30,7 +30,7 @@ extern "C" {
typedef void (* RX_CALLBACK)(void * dev, void *osbuf);
typedef void (* ALLOC_NETBUFS)(A_NETBUF_QUEUE_T *q, A_UINT16 num);
typedef void (* ALLOC_NETBUFS)(A_NETBUF_QUEUE_T *q, u16 num);
/*
* aggr_init:
@ -64,7 +64,7 @@ aggr_register_rx_dispatcher(void *cntxt, void * dev, RX_CALLBACK fn);
* up to the indicated sequence number.
*/
void
aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no);
aggr_process_bar(void *cntxt, u8 tid, u16 seq_no);
/*
@ -82,7 +82,7 @@ aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no);
* in hold_q to OS.
*/
void
aggr_recv_addba_req_evt(void * cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_sz);
aggr_recv_addba_req_evt(void * cntxt, u8 tid, u16 seq_no, u8 win_sz);
/*
@ -93,7 +93,7 @@ aggr_recv_addba_req_evt(void * cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_
* aggr is not enabled on any tid.
*/
void
aggr_recv_delba_req_evt(void * cntxt, A_UINT8 tid);
aggr_recv_delba_req_evt(void * cntxt, u8 tid);
@ -108,7 +108,7 @@ aggr_recv_delba_req_evt(void * cntxt, A_UINT8 tid);
* callback may be called to deliver frames in order.
*/
void
aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu, void **osbuf);
aggr_process_recv_frm(void *cntxt, u8 tid, u16 seq_no, bool is_amsdu, void **osbuf);
/*

View File

@ -38,25 +38,25 @@ extern "C" {
#define AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP (1 << 3)
typedef struct {
A_UINT32 Flags; /* config flags */
struct ar3k_config_info {
u32 Flags; /* config flags */
void *pHCIDev; /* HCI bridge device */
HCI_TRANSPORT_PROPERTIES *pHCIProps; /* HCI bridge props */
HIF_DEVICE *pHIFDevice; /* HIF layer device */
struct hci_transport_properties *pHCIProps; /* HCI bridge props */
struct hif_device *pHIFDevice; /* HIF layer device */
A_UINT32 AR3KBaudRate; /* AR3K operational baud rate */
A_UINT16 AR6KScale; /* AR6K UART scale value */
A_UINT16 AR6KStep; /* AR6K UART step value */
u32 AR3KBaudRate; /* AR3K operational baud rate */
u16 AR6KScale; /* AR6K UART scale value */
u16 AR6KStep; /* AR6K UART step value */
struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */
A_UINT32 PwrMgmtEnabled; /* TLPM enabled? */
A_UINT16 IdleTimeout; /* TLPM idle timeout */
A_UINT16 WakeupTimeout; /* TLPM wakeup timeout */
A_UINT8 bdaddr[6]; /* Bluetooth device address */
} AR3K_CONFIG_INFO;
u32 PwrMgmtEnabled; /* TLPM enabled? */
u16 IdleTimeout; /* TLPM idle timeout */
u16 WakeupTimeout; /* TLPM wakeup timeout */
u8 bdaddr[6]; /* Bluetooth device address */
};
A_STATUS AR3KConfigure(AR3K_CONFIG_INFO *pConfigInfo);
int AR3KConfigure(struct ar3k_config_info *pConfigInfo);
A_STATUS AR3KConfigureExit(void *config);
int AR3KConfigureExit(void *config);
#ifdef __cplusplus
}

View File

@ -25,24 +25,24 @@
#define AR6000_DIAG_H_
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
ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
int
ar6000_WriteRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
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_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_STATUS
ar6k_ReadTargetRegister(HIF_DEVICE *hifDevice, int regsel, A_UINT32 *regval);
int
ar6k_ReadTargetRegister(struct hif_device *hifDevice, int regsel, u32 *regval);
void
ar6k_FetchTargetRegs(HIF_DEVICE *hifDevice, A_UINT32 *targregs);
ar6k_FetchTargetRegs(struct hif_device *hifDevice, u32 *targregs);
#endif /*AR6000_DIAG_H_*/

View File

@ -32,11 +32,11 @@
* Used with AR6000_XIOCTL_AP_GET_STA_LIST
*/
typedef struct {
A_UINT8 mac[ATH_MAC_LEN];
A_UINT8 aid;
A_UINT8 keymgmt;
A_UINT8 ucipher;
A_UINT8 auth;
u8 mac[ATH_MAC_LEN];
u8 aid;
u8 keymgmt;
u8 ucipher;
u8 auth;
} station_t;
typedef struct {
station_t sta[AP_MAX_NUM_STA];

View File

@ -61,11 +61,11 @@ typedef enum _ATHBT_STATE {
typedef void (*ATHBT_INDICATE_STATE_FN)(void *pContext, ATHBT_STATE_INDICATION Indication, ATHBT_STATE State, unsigned char LMPVersion);
typedef struct _ATHBT_FILTER_INSTANCE {
struct athbt_filter_instance {
#ifdef UNDER_CE
WCHAR *pWlanAdapterName; /* filled in by user */
#else
char *pWlanAdapterName; /* filled in by user */
char *pWlanAdapterName; /* filled in by user */
#endif /* UNDER_CE */
int FilterEnabled; /* filtering is enabled */
int Attached; /* filter library is attached */
@ -74,7 +74,7 @@ typedef struct _ATHBT_FILTER_INSTANCE {
ATHBT_FILTER_DATA_FN pFilterAclDataOut; /* function ptr to filter ACL data out (to radio) */
ATHBT_FILTER_DATA_FN pFilterAclDataIn; /* function ptr to filter ACL data in (from radio) */
ATHBT_INDICATE_STATE_FN pIndicateState; /* function ptr to indicate a state */
} ATH_BT_FILTER_INSTANCE;
}; /* XXX: unused ? */
/* API MACROS */

View File

@ -43,90 +43,90 @@ BMIInit(void);
void
BMICleanup(void);
A_STATUS
BMIDone(HIF_DEVICE *device);
int
BMIDone(struct hif_device *device);
A_STATUS
BMIGetTargetInfo(HIF_DEVICE *device, struct bmi_target_info *targ_info);
int
BMIGetTargetInfo(struct hif_device *device, struct bmi_target_info *targ_info);
A_STATUS
BMIReadMemory(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length);
int
BMIReadMemory(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length);
A_STATUS
BMIWriteMemory(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length);
int
BMIWriteMemory(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length);
A_STATUS
BMIExecute(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 *param);
int
BMIExecute(struct hif_device *device,
u32 address,
u32 *param);
A_STATUS
BMISetAppStart(HIF_DEVICE *device,
A_UINT32 address);
int
BMISetAppStart(struct hif_device *device,
u32 address);
A_STATUS
BMIReadSOCRegister(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 *param);
int
BMIReadSOCRegister(struct hif_device *device,
u32 address,
u32 *param);
A_STATUS
BMIWriteSOCRegister(HIF_DEVICE *device,
A_UINT32 address,
A_UINT32 param);
int
BMIWriteSOCRegister(struct hif_device *device,
u32 address,
u32 param);
A_STATUS
BMIrompatchInstall(HIF_DEVICE *device,
A_UINT32 ROM_addr,
A_UINT32 RAM_addr,
A_UINT32 nbytes,
A_UINT32 do_activate,
A_UINT32 *patch_id);
int
BMIrompatchInstall(struct hif_device *device,
u32 ROM_addr,
u32 RAM_addr,
u32 nbytes,
u32 do_activate,
u32 *patch_id);
A_STATUS
BMIrompatchUninstall(HIF_DEVICE *device,
A_UINT32 rompatch_id);
int
BMIrompatchUninstall(struct hif_device *device,
u32 rompatch_id);
A_STATUS
BMIrompatchActivate(HIF_DEVICE *device,
A_UINT32 rompatch_count,
A_UINT32 *rompatch_list);
int
BMIrompatchActivate(struct hif_device *device,
u32 rompatch_count,
u32 *rompatch_list);
A_STATUS
BMIrompatchDeactivate(HIF_DEVICE *device,
A_UINT32 rompatch_count,
A_UINT32 *rompatch_list);
int
BMIrompatchDeactivate(struct hif_device *device,
u32 rompatch_count,
u32 *rompatch_list);
A_STATUS
BMILZStreamStart(HIF_DEVICE *device,
A_UINT32 address);
int
BMILZStreamStart(struct hif_device *device,
u32 address);
A_STATUS
BMILZData(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length);
int
BMILZData(struct hif_device *device,
u8 *buffer,
u32 length);
A_STATUS
BMIFastDownload(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length);
int
BMIFastDownload(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length);
A_STATUS
BMIRawWrite(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length);
int
BMIRawWrite(struct hif_device *device,
u8 *buffer,
u32 length);
A_STATUS
BMIRawRead(HIF_DEVICE *device,
A_UCHAR *buffer,
A_UINT32 length,
A_BOOL want_timeout);
int
BMIRawRead(struct hif_device *device,
u8 *buffer,
u32 length,
bool want_timeout);
#ifdef __cplusplus
}

View File

@ -29,28 +29,28 @@
* This must match the state saved by the target exception handler.
*/
struct XTensa_exception_frame_s {
A_UINT32 xt_pc;
A_UINT32 xt_ps;
A_UINT32 xt_sar;
A_UINT32 xt_vpri;
A_UINT32 xt_a2;
A_UINT32 xt_a3;
A_UINT32 xt_a4;
A_UINT32 xt_a5;
A_UINT32 xt_exccause;
A_UINT32 xt_lcount;
A_UINT32 xt_lbeg;
A_UINT32 xt_lend;
u32 xt_pc;
u32 xt_ps;
u32 xt_sar;
u32 xt_vpri;
u32 xt_a2;
u32 xt_a3;
u32 xt_a4;
u32 xt_a5;
u32 xt_exccause;
u32 xt_lcount;
u32 xt_lbeg;
u32 xt_lend;
A_UINT32 epc1, epc2, epc3, epc4;
u32 epc1, epc2, epc3, epc4;
/* Extra info to simplify post-mortem stack walkback */
#define AR6002_REGDUMP_FRAMES 10
struct {
A_UINT32 a0; /* pc */
A_UINT32 a1; /* sp */
A_UINT32 a2;
A_UINT32 a3;
u32 a0; /* pc */
u32 a1; /* sp */
u32 a2;
u32 a3;
} wb[AR6002_REGDUMP_FRAMES];
};
typedef struct XTensa_exception_frame_s CPU_exception_frame_t;

View File

@ -29,13 +29,13 @@
#if defined(AR6002_REV2)
#define AR6K_RAM_START 0x00500000
#define TARG_RAM_OFFSET(vaddr) ((A_UINT32)(vaddr) & 0xfffff)
#define TARG_RAM_OFFSET(vaddr) ((u32)(vaddr) & 0xfffff)
#define TARG_RAM_SZ (184*1024)
#define TARG_ROM_SZ (80*1024)
#endif
#if defined(AR6002_REV4) || defined(AR6003)
#define AR6K_RAM_START 0x00540000
#define TARG_RAM_OFFSET(vaddr) (((A_UINT32)(vaddr) & 0xfffff) - 0x40000)
#define TARG_RAM_OFFSET(vaddr) (((u32)(vaddr) & 0xfffff) - 0x40000)
#define TARG_RAM_SZ (256*1024)
#define TARG_ROM_SZ (256*1024)
#endif
@ -49,7 +49,7 @@
#define TARG_RAM_ADDRS(byte_offset) AR6K_RAM_ADDR(byte_offset)
#define AR6K_ROM_START 0x004e0000
#define TARG_ROM_OFFSET(vaddr) (((A_UINT32)(vaddr) & 0x1fffff) - 0xe0000)
#define TARG_ROM_OFFSET(vaddr) (((u32)(vaddr) & 0x1fffff) - 0xe0000)
#define AR6K_ROM_ADDR(byte_offset) (AR6K_ROM_START+(byte_offset))
#define TARG_ROM_ADDRS(byte_offset) AR6K_ROM_ADDR(byte_offset)

View File

@ -242,161 +242,161 @@ typedef enum {
/* Command pkt */
typedef struct hci_cmd_pkt_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 params[255];
u16 opcode;
u8 param_length;
u8 params[255];
} POSTPACK HCI_CMD_PKT;
#define ACL_DATA_HDR_SIZE 4 /* hdl_and flags + data_len */
/* Data pkt */
typedef struct hci_acl_data_pkt_t {
A_UINT16 hdl_and_flags;
A_UINT16 data_len;
A_UINT8 data[Max80211_PAL_PDU_Size];
u16 hdl_and_flags;
u16 data_len;
u8 data[Max80211_PAL_PDU_Size];
} POSTPACK HCI_ACL_DATA_PKT;
/* Event pkt */
typedef struct hci_event_pkt_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 params[256];
u8 event_code;
u8 param_len;
u8 params[256];
} POSTPACK HCI_EVENT_PKT;
/*============== HCI Command definitions ======================= */
typedef struct hci_cmd_phy_link_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
A_UINT8 link_key_len;
A_UINT8 link_key_type;
A_UINT8 link_key[LINK_KEY_LEN];
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
u8 link_key_len;
u8 link_key_type;
u8 link_key[LINK_KEY_LEN];
} POSTPACK HCI_CMD_PHY_LINK;
typedef struct hci_cmd_write_rem_amp_assoc_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
A_UINT16 len_so_far;
A_UINT16 amp_assoc_remaining_len;
A_UINT8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ];
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
u16 len_so_far;
u16 amp_assoc_remaining_len;
u8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ];
} POSTPACK HCI_CMD_WRITE_REM_AMP_ASSOC;
typedef struct hci_cmd_opcode_hdl_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 hdl;
u16 opcode;
u8 param_length;
u16 hdl;
} POSTPACK HCI_CMD_READ_LINK_QUAL,
HCI_CMD_FLUSH,
HCI_CMD_READ_LINK_SUPERVISION_TIMEOUT;
typedef struct hci_cmd_read_local_amp_assoc_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
A_UINT16 len_so_far;
A_UINT16 max_rem_amp_assoc_len;
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
u16 len_so_far;
u16 max_rem_amp_assoc_len;
} POSTPACK HCI_CMD_READ_LOCAL_AMP_ASSOC;
typedef struct hci_cmd_set_event_mask_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT64 mask;
u16 opcode;
u8 param_length;
u64 mask;
}POSTPACK HCI_CMD_SET_EVT_MASK, HCI_CMD_SET_EVT_MASK_PG_2;
typedef struct hci_cmd_enhanced_flush_t{
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 hdl;
A_UINT8 type;
u16 opcode;
u8 param_length;
u16 hdl;
u8 type;
} POSTPACK HCI_CMD_ENHANCED_FLUSH;
typedef struct hci_cmd_write_timeout_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 timeout;
u16 opcode;
u8 param_length;
u16 timeout;
} POSTPACK HCI_CMD_WRITE_TIMEOUT;
typedef struct hci_cmd_write_link_supervision_timeout_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 hdl;
A_UINT16 timeout;
u16 opcode;
u8 param_length;
u16 hdl;
u16 timeout;
} POSTPACK HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT;
typedef struct hci_cmd_write_flow_control_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 mode;
u16 opcode;
u8 param_length;
u8 mode;
} POSTPACK HCI_CMD_WRITE_FLOW_CONTROL;
typedef struct location_data_cfg_t {
A_UINT8 reg_domain_aware;
A_UINT8 reg_domain[3];
A_UINT8 reg_options;
u8 reg_domain_aware;
u8 reg_domain[3];
u8 reg_options;
} POSTPACK LOCATION_DATA_CFG;
typedef struct hci_cmd_write_location_data_t {
A_UINT16 opcode;
A_UINT8 param_length;
u16 opcode;
u8 param_length;
LOCATION_DATA_CFG cfg;
} POSTPACK HCI_CMD_WRITE_LOCATION_DATA;
typedef struct flow_spec_t {
A_UINT8 id;
A_UINT8 service_type;
A_UINT16 max_sdu;
A_UINT32 sdu_inter_arrival_time;
A_UINT32 access_latency;
A_UINT32 flush_timeout;
u8 id;
u8 service_type;
u16 max_sdu;
u32 sdu_inter_arrival_time;
u32 access_latency;
u32 flush_timeout;
} POSTPACK FLOW_SPEC;
typedef struct hci_cmd_create_logical_link_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
FLOW_SPEC tx_flow_spec;
FLOW_SPEC rx_flow_spec;
} POSTPACK HCI_CMD_CREATE_LOGICAL_LINK;
typedef struct hci_cmd_flow_spec_modify_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 hdl;
u16 opcode;
u8 param_length;
u16 hdl;
FLOW_SPEC tx_flow_spec;
FLOW_SPEC rx_flow_spec;
} POSTPACK HCI_CMD_FLOW_SPEC_MODIFY;
typedef struct hci_cmd_logical_link_cancel_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
A_UINT8 tx_flow_spec_id;
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
u8 tx_flow_spec_id;
} POSTPACK HCI_CMD_LOGICAL_LINK_CANCEL;
typedef struct hci_cmd_disconnect_logical_link_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT16 logical_link_hdl;
u16 opcode;
u8 param_length;
u16 logical_link_hdl;
} POSTPACK HCI_CMD_DISCONNECT_LOGICAL_LINK;
typedef struct hci_cmd_disconnect_phy_link_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
} POSTPACK HCI_CMD_DISCONNECT_PHY_LINK;
typedef struct hci_cmd_srm_t {
A_UINT16 opcode;
A_UINT8 param_length;
A_UINT8 phy_link_hdl;
A_UINT8 mode;
u16 opcode;
u8 param_length;
u8 phy_link_hdl;
u8 mode;
} POSTPACK HCI_CMD_SHORT_RANGE_MODE;
/*============== HCI Command definitions end ======================= */
@ -406,175 +406,175 @@ typedef struct hci_cmd_srm_t {
/* Command complete event */
typedef struct hci_event_cmd_complete_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 num_hci_cmd_pkts;
A_UINT16 opcode;
A_UINT8 params[255];
u8 event_code;
u8 param_len;
u8 num_hci_cmd_pkts;
u16 opcode;
u8 params[255];
} POSTPACK HCI_EVENT_CMD_COMPLETE;
/* Command status event */
typedef struct hci_event_cmd_status_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT8 num_hci_cmd_pkts;
A_UINT16 opcode;
u8 event_code;
u8 param_len;
u8 status;
u8 num_hci_cmd_pkts;
u16 opcode;
} POSTPACK HCI_EVENT_CMD_STATUS;
/* Hardware Error event */
typedef struct hci_event_hw_err_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 hw_err_code;
u8 event_code;
u8 param_len;
u8 hw_err_code;
} POSTPACK HCI_EVENT_HW_ERR;
/* Flush occured event */
/* Qos Violation event */
typedef struct hci_event_handle_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT16 handle;
u8 event_code;
u8 param_len;
u16 handle;
} POSTPACK HCI_EVENT_FLUSH_OCCRD,
HCI_EVENT_QOS_VIOLATION;
/* Loopback command event */
typedef struct hci_loopback_cmd_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 params[252];
u8 event_code;
u8 param_len;
u8 params[252];
} POSTPACK HCI_EVENT_LOOPBACK_CMD;
/* Data buffer overflow event */
typedef struct hci_data_buf_overflow_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 link_type;
u8 event_code;
u8 param_len;
u8 link_type;
} POSTPACK HCI_EVENT_DATA_BUF_OVERFLOW;
/* Enhanced Flush complete event */
typedef struct hci_enhanced_flush_complt_t{
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT16 hdl;
u8 event_code;
u8 param_len;
u16 hdl;
} POSTPACK HCI_EVENT_ENHANCED_FLUSH_COMPLT;
/* Channel select event */
typedef struct hci_event_chan_select_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 phy_link_hdl;
u8 event_code;
u8 param_len;
u8 phy_link_hdl;
} POSTPACK HCI_EVENT_CHAN_SELECT;
/* Physical Link Complete event */
typedef struct hci_event_phy_link_complete_event_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT8 phy_link_hdl;
u8 event_code;
u8 param_len;
u8 status;
u8 phy_link_hdl;
} POSTPACK HCI_EVENT_PHY_LINK_COMPLETE;
/* Logical Link complete event */
typedef struct hci_event_logical_link_complete_event_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT16 logical_link_hdl;
A_UINT8 phy_hdl;
A_UINT8 tx_flow_id;
u8 event_code;
u8 param_len;
u8 status;
u16 logical_link_hdl;
u8 phy_hdl;
u8 tx_flow_id;
} POSTPACK HCI_EVENT_LOGICAL_LINK_COMPLETE_EVENT;
/* Disconnect Logical Link complete event */
typedef struct hci_event_disconnect_logical_link_event_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT16 logical_link_hdl;
A_UINT8 reason;
u8 event_code;
u8 param_len;
u8 status;
u16 logical_link_hdl;
u8 reason;
} POSTPACK HCI_EVENT_DISCONNECT_LOGICAL_LINK_EVENT;
/* Disconnect Physical Link complete event */
typedef struct hci_event_disconnect_phy_link_complete_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT8 phy_link_hdl;
A_UINT8 reason;
u8 event_code;
u8 param_len;
u8 status;
u8 phy_link_hdl;
u8 reason;
} POSTPACK HCI_EVENT_DISCONNECT_PHY_LINK_COMPLETE;
typedef struct hci_event_physical_link_loss_early_warning_t{
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 phy_hdl;
A_UINT8 reason;
u8 event_code;
u8 param_len;
u8 phy_hdl;
u8 reason;
} POSTPACK HCI_EVENT_PHY_LINK_LOSS_EARLY_WARNING;
typedef struct hci_event_physical_link_recovery_t{
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 phy_hdl;
u8 event_code;
u8 param_len;
u8 phy_hdl;
} POSTPACK HCI_EVENT_PHY_LINK_RECOVERY;
/* Flow spec modify complete event */
/* Flush event */
typedef struct hci_event_status_handle_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT16 handle;
u8 event_code;
u8 param_len;
u8 status;
u16 handle;
} POSTPACK HCI_EVENT_FLOW_SPEC_MODIFY,
HCI_EVENT_FLUSH;
/* Num of completed data blocks event */
typedef struct hci_event_num_of_compl_data_blks_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT16 num_data_blks;
A_UINT8 num_handles;
A_UINT8 params[255];
u8 event_code;
u8 param_len;
u16 num_data_blks;
u8 num_handles;
u8 params[255];
} POSTPACK HCI_EVENT_NUM_COMPL_DATA_BLKS;
/* Short range mode change complete event */
typedef struct hci_srm_cmpl_t {
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT8 phy_link;
A_UINT8 state;
u8 event_code;
u8 param_len;
u8 status;
u8 phy_link;
u8 state;
} POSTPACK HCI_EVENT_SRM_COMPL;
typedef struct hci_event_amp_status_change_t{
A_UINT8 event_code;
A_UINT8 param_len;
A_UINT8 status;
A_UINT8 amp_status;
u8 event_code;
u8 param_len;
u8 status;
u8 amp_status;
} POSTPACK HCI_EVENT_AMP_STATUS_CHANGE;
/*============== Event definitions end =========================== */
typedef struct local_amp_info_resp_t {
A_UINT8 status;
A_UINT8 amp_status;
A_UINT32 total_bw; /* kbps */
A_UINT32 max_guranteed_bw; /* kbps */
A_UINT32 min_latency;
A_UINT32 max_pdu_size;
A_UINT8 amp_type;
A_UINT16 pal_capabilities;
A_UINT16 amp_assoc_len;
A_UINT32 max_flush_timeout; /* in ms */
A_UINT32 be_flush_timeout; /* in ms */
u8 status;
u8 amp_status;
u32 total_bw; /* kbps */
u32 max_guranteed_bw; /* kbps */
u32 min_latency;
u32 max_pdu_size;
u8 amp_type;
u16 pal_capabilities;
u16 amp_assoc_len;
u32 max_flush_timeout; /* in ms */
u32 be_flush_timeout; /* in ms */
} POSTPACK LOCAL_AMP_INFO;
typedef struct amp_assoc_cmd_resp_t{
A_UINT8 status;
A_UINT8 phy_hdl;
A_UINT16 amp_assoc_len;
A_UINT8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ];
u8 status;
u8 phy_hdl;
u16 amp_assoc_len;
u8 amp_assoc_frag[AMP_ASSOC_MAX_FRAG_SZ];
}POSTPACK AMP_ASSOC_CMD_RESP;
@ -618,64 +618,64 @@ enum PAL_HCI_CMD_STATUS {
/* Following are event return parameters.. part of HCI events
*/
typedef struct timeout_read_t {
A_UINT8 status;
A_UINT16 timeout;
u8 status;
u16 timeout;
}POSTPACK TIMEOUT_INFO;
typedef struct link_supervision_timeout_read_t {
A_UINT8 status;
A_UINT16 hdl;
A_UINT16 timeout;
u8 status;
u16 hdl;
u16 timeout;
}POSTPACK LINK_SUPERVISION_TIMEOUT_INFO;
typedef struct status_hdl_t {
A_UINT8 status;
A_UINT16 hdl;
u8 status;
u16 hdl;
}POSTPACK INFO_STATUS_HDL;
typedef struct write_remote_amp_assoc_t{
A_UINT8 status;
A_UINT8 hdl;
u8 status;
u8 hdl;
}POSTPACK WRITE_REMOTE_AMP_ASSOC_INFO;
typedef struct read_loc_info_t {
A_UINT8 status;
u8 status;
LOCATION_DATA_CFG loc;
}POSTPACK READ_LOC_INFO;
typedef struct read_flow_ctrl_mode_t {
A_UINT8 status;
A_UINT8 mode;
u8 status;
u8 mode;
}POSTPACK READ_FLWCTRL_INFO;
typedef struct read_data_blk_size_t {
A_UINT8 status;
A_UINT16 max_acl_data_pkt_len;
A_UINT16 data_block_len;
A_UINT16 total_num_data_blks;
u8 status;
u16 max_acl_data_pkt_len;
u16 data_block_len;
u16 total_num_data_blks;
}POSTPACK READ_DATA_BLK_SIZE_INFO;
/* Read Link quality info */
typedef struct link_qual_t {
A_UINT8 status;
A_UINT16 hdl;
A_UINT8 link_qual;
u8 status;
u16 hdl;
u8 link_qual;
} POSTPACK READ_LINK_QUAL_INFO,
READ_RSSI_INFO;
typedef struct ll_cancel_resp_t {
A_UINT8 status;
A_UINT8 phy_link_hdl;
A_UINT8 tx_flow_spec_id;
u8 status;
u8 phy_link_hdl;
u8 tx_flow_spec_id;
} POSTPACK LL_CANCEL_RESP;
typedef struct read_local_ver_info_t {
A_UINT8 status;
A_UINT8 hci_version;
A_UINT16 hci_revision;
A_UINT8 pal_version;
A_UINT16 manf_name;
A_UINT16 pal_sub_ver;
u8 status;
u8 hci_version;
u16 hci_revision;
u8 pal_version;
u16 manf_name;
u16 pal_sub_ver;
} POSTPACK READ_LOCAL_VER_INFO;

View File

@ -31,54 +31,45 @@
/*
* Generic error codes that can be used by hw, sta, ap, sim, dk
* and any other environments. Since these are enums, feel free to
* add any more codes that you need.
* and any other environments.
* Feel free to add any more non-zero codes that you need.
*/
typedef enum {
A_ERROR = -1, /* Generic error return */
A_OK = 0, /* success */
/* Following values start at 1 */
A_DEVICE_NOT_FOUND, /* not able to find PCI device */
A_NO_MEMORY, /* not able to allocate memory, not available */
A_MEMORY_NOT_AVAIL, /* memory region is not free for mapping */
A_NO_FREE_DESC, /* no free descriptors available */
A_BAD_ADDRESS, /* address does not match descriptor */
A_WIN_DRIVER_ERROR, /* used in NT_HW version, if problem at init */
A_REGS_NOT_MAPPED, /* registers not correctly mapped */
A_EPERM, /* Not superuser */
A_EACCES, /* Access denied */
A_ENOENT, /* No such entry, search failed, etc. */
A_EEXIST, /* The object already exists (can't create) */
A_EFAULT, /* Bad address fault */
A_EBUSY, /* Object is busy */
A_EINVAL, /* Invalid parameter */
A_EMSGSIZE, /* Inappropriate message buffer length */
A_ECANCELED, /* Operation canceled */
A_ENOTSUP, /* Operation not supported */
A_ECOMM, /* Communication error on send */
A_EPROTO, /* Protocol error */
A_ENODEV, /* No such device */
A_EDEVNOTUP, /* device is not UP */
A_NO_RESOURCE, /* No resources for requested operation */
A_HARDWARE, /* Hardware failure */
A_PENDING, /* Asynchronous routine; will send up results la
ter (typically in callback) */
A_EBADCHANNEL, /* The channel cannot be used */
A_DECRYPT_ERROR, /* Decryption error */
A_PHY_ERROR, /* RX PHY error */
A_CONSUMED /* Object was consumed */
} A_STATUS;
#define A_SUCCESS(x) (x == A_OK)
#define A_FAILED(x) (!A_SUCCESS(x))
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define A_ERROR (-1) /* Generic error return */
#define A_DEVICE_NOT_FOUND 1 /* not able to find PCI device */
#define A_NO_MEMORY 2 /* not able to allocate memory,
* not avail#defineable */
#define A_MEMORY_NOT_AVAIL 3 /* memory region is not free for
* mapping */
#define A_NO_FREE_DESC 4 /* no free descriptors available */
#define A_BAD_ADDRESS 5 /* address does not match descriptor */
#define A_WIN_DRIVER_ERROR 6 /* used in NT_HW version,
* if problem at init */
#define A_REGS_NOT_MAPPED 7 /* registers not correctly mapped */
#define A_EPERM 8 /* Not superuser */
#define A_EACCES 0 /* Access denied */
#define A_ENOENT 10 /* No such entry, search failed, etc. */
#define A_EEXIST 11 /* The object already exists
* (can't create) */
#define A_EFAULT 12 /* Bad address fault */
#define A_EBUSY 13 /* Object is busy */
#define A_EINVAL 14 /* Invalid parameter */
#define A_EMSGSIZE 15 /* Bad message buffer length */
#define A_ECANCELED 16 /* Operation canceled */
#define A_ENOTSUP 17 /* Operation not supported */
#define A_ECOMM 18 /* Communication error on send */
#define A_EPROTO 19 /* Protocol error */
#define A_ENODEV 20 /* No such device */
#define A_EDEVNOTUP 21 /* device is not UP */
#define A_NO_RESOURCE 22 /* No resources for
* requested operation */
#define A_HARDWARE 23 /* Hardware failure */
#define A_PENDING 24 /* Asynchronous routine; will send up
* results later
* (typically in callback) */
#define A_EBADCHANNEL 25 /* The channel cannot be used */
#define A_DECRYPT_ERROR 26 /* Decryption error */
#define A_PHY_ERROR 27 /* RX PHY error */
#define A_CONSUMED 28 /* Object was consumed */
#endif /* __ATHDEFS_H__ */

View File

@ -65,7 +65,7 @@
/*
* Semantics: Host is done using BMI
* Request format:
* A_UINT32 command (BMI_DONE)
* u32 command (BMI_DONE)
* Response format: none
*/
@ -73,21 +73,21 @@
/*
* Semantics: Host reads AR6K memory
* Request format:
* A_UINT32 command (BMI_READ_MEMORY)
* A_UINT32 address
* A_UINT32 length, at most BMI_DATASZ_MAX
* u32 command (BMI_READ_MEMORY)
* u32 address
* u32 length, at most BMI_DATASZ_MAX
* Response format:
* A_UINT8 data[length]
* u8 data[length]
*/
#define BMI_WRITE_MEMORY 3
/*
* Semantics: Host writes AR6K memory
* Request format:
* A_UINT32 command (BMI_WRITE_MEMORY)
* A_UINT32 address
* A_UINT32 length, at most BMI_DATASZ_MAX
* A_UINT8 data[length]
* u32 command (BMI_WRITE_MEMORY)
* u32 address
* u32 length, at most BMI_DATASZ_MAX
* u8 data[length]
* Response format: none
*/
@ -95,19 +95,19 @@
/*
* Semantics: Causes AR6K to execute code
* Request format:
* A_UINT32 command (BMI_EXECUTE)
* A_UINT32 address
* A_UINT32 parameter
* u32 command (BMI_EXECUTE)
* u32 address
* u32 parameter
* Response format:
* A_UINT32 return value
* u32 return value
*/
#define BMI_SET_APP_START 5
/*
* Semantics: Set Target application starting address
* Request format:
* A_UINT32 command (BMI_SET_APP_START)
* A_UINT32 address
* u32 command (BMI_SET_APP_START)
* u32 address
* Response format: none
*/
@ -115,19 +115,19 @@
/*
* Semantics: Read a 32-bit Target SOC register.
* Request format:
* A_UINT32 command (BMI_READ_REGISTER)
* A_UINT32 address
* u32 command (BMI_READ_REGISTER)
* u32 address
* Response format:
* A_UINT32 value
* u32 value
*/
#define BMI_WRITE_SOC_REGISTER 7
/*
* Semantics: Write a 32-bit Target SOC register.
* Request format:
* A_UINT32 command (BMI_WRITE_REGISTER)
* A_UINT32 address
* A_UINT32 value
* u32 command (BMI_WRITE_REGISTER)
* u32 address
* u32 value
*
* Response format: none
*/
@ -137,18 +137,18 @@
/*
* Semantics: Fetch the 4-byte Target information
* Request format:
* A_UINT32 command (BMI_GET_TARGET_ID/INFO)
* u32 command (BMI_GET_TARGET_ID/INFO)
* Response format1 (old firmware):
* A_UINT32 TargetVersionID
* u32 TargetVersionID
* Response format2 (newer firmware):
* A_UINT32 TARGET_VERSION_SENTINAL
* u32 TARGET_VERSION_SENTINAL
* struct bmi_target_info;
*/
PREPACK struct bmi_target_info {
A_UINT32 target_info_byte_count; /* size of this structure */
A_UINT32 target_ver; /* Target Version ID */
A_UINT32 target_type; /* Target type */
u32 target_info_byte_count; /* size of this structure */
u32 target_ver; /* Target Version ID */
u32 target_type; /* Target type */
} POSTPACK;
#define TARGET_VERSION_SENTINAL 0xffffffff
#define TARGET_TYPE_AR6001 1
@ -160,14 +160,14 @@ PREPACK struct bmi_target_info {
/*
* Semantics: Install a ROM Patch.
* Request format:
* A_UINT32 command (BMI_ROMPATCH_INSTALL)
* A_UINT32 Target ROM Address
* A_UINT32 Target RAM Address or Value (depending on Target Type)
* A_UINT32 Size, in bytes
* A_UINT32 Activate? 1-->activate;
* u32 command (BMI_ROMPATCH_INSTALL)
* u32 Target ROM Address
* u32 Target RAM Address or Value (depending on Target Type)
* u32 Size, in bytes
* u32 Activate? 1-->activate;
* 0-->install but do not activate
* Response format:
* A_UINT32 PatchID
* u32 PatchID
*/
#define BMI_ROMPATCH_UNINSTALL 10
@ -175,8 +175,8 @@ PREPACK struct bmi_target_info {
* Semantics: Uninstall a previously-installed ROM Patch,
* automatically deactivating, if necessary.
* Request format:
* A_UINT32 command (BMI_ROMPATCH_UNINSTALL)
* A_UINT32 PatchID
* u32 command (BMI_ROMPATCH_UNINSTALL)
* u32 PatchID
*
* Response format: none
*/
@ -185,9 +185,9 @@ PREPACK struct bmi_target_info {
/*
* Semantics: Activate a list of previously-installed ROM Patches.
* Request format:
* A_UINT32 command (BMI_ROMPATCH_ACTIVATE)
* A_UINT32 rompatch_count
* A_UINT32 PatchID[rompatch_count]
* u32 command (BMI_ROMPATCH_ACTIVATE)
* u32 rompatch_count
* u32 PatchID[rompatch_count]
*
* Response format: none
*/
@ -196,9 +196,9 @@ PREPACK struct bmi_target_info {
/*
* Semantics: Deactivate a list of active ROM Patches.
* Request format:
* A_UINT32 command (BMI_ROMPATCH_DEACTIVATE)
* A_UINT32 rompatch_count
* A_UINT32 PatchID[rompatch_count]
* u32 command (BMI_ROMPATCH_DEACTIVATE)
* u32 rompatch_count
* u32 PatchID[rompatch_count]
*
* Response format: none
*/
@ -213,8 +213,8 @@ PREPACK struct bmi_target_info {
* output from the compressed input stream. This BMI
* command should be followed by a series of 1 or more
* BMI_LZ_DATA commands.
* A_UINT32 command (BMI_LZ_STREAM_START)
* A_UINT32 address
* u32 command (BMI_LZ_STREAM_START)
* u32 address
* Note: Not supported on all versions of ROM firmware.
*/
@ -226,10 +226,10 @@ PREPACK struct bmi_target_info {
* of BMI_LZ_DATA commands are considered part of a single
* input stream until another BMI_LZ_STREAM_START is issued.
* Request format:
* A_UINT32 command (BMI_LZ_DATA)
* A_UINT32 length (of compressed data),
* u32 command (BMI_LZ_DATA)
* u32 length (of compressed data),
* at most BMI_DATASZ_MAX
* A_UINT8 CompressedData[length]
* u8 CompressedData[length]
* Response format: none
* Note: Not supported on all versions of ROM firmware.
*/

View File

@ -71,8 +71,8 @@
extern void btcoexDbgPulseWord(A_UINT32 gpioPinMask);
extern void btcoexDbgPulse(A_UINT32 pin);
extern void btcoexDbgPulseWord(u32 gpioPinMask);
extern void btcoexDbgPulse(u32 pin);
#ifdef CONFIG_BTCOEX_ENABLE_GPIO_DEBUG
#define BTCOEX_DBG_PULSE_WORD(gpioPinMask) (btcoexDbgPulseWord(gpioPinMask))

View File

@ -89,31 +89,31 @@ extern "C" {
PREPACK struct dbglog_buf_s {
struct dbglog_buf_s *next;
A_UINT8 *buffer;
A_UINT32 bufsize;
A_UINT32 length;
A_UINT32 count;
A_UINT32 free;
u8 *buffer;
u32 bufsize;
u32 length;
u32 count;
u32 free;
} POSTPACK;
PREPACK struct dbglog_hdr_s {
struct dbglog_buf_s *dbuf;
A_UINT32 dropped;
u32 dropped;
} POSTPACK;
PREPACK struct dbglog_config_s {
A_UINT32 cfgvalid; /* Mask with valid config bits */
u32 cfgvalid; /* Mask with valid config bits */
union {
/* TODO: Take care of endianness */
struct {
A_UINT32 mmask:16; /* Mask of modules with logging on */
A_UINT32 rep:1; /* Reporting enabled or not */
A_UINT32 tsr:3; /* Time stamp resolution. Def: 1 ms */
A_UINT32 size:10; /* Report size in number of messages */
A_UINT32 reserved:2;
u32 mmask:16; /* Mask of modules with logging on */
u32 rep:1; /* Reporting enabled or not */
u32 tsr:3; /* Time stamp resolution. Def: 1 ms */
u32 size:10; /* Report size in number of messages */
u32 reserved:2;
} dbglog_config;
A_UINT32 value;
u32 value;
} u;
} POSTPACK;

View File

@ -42,13 +42,13 @@
typedef PREPACK struct dset_descriptor_s {
struct dset_descriptor_s *next; /* List link. NULL only at the last
descriptor */
A_UINT16 id; /* Dset ID */
A_UINT16 size; /* Dset size. */
u16 id; /* Dset ID */
u16 size; /* Dset size. */
void *DataPtr; /* Pointer to raw data for standard
DataSet or pointer to original
dset_descriptor for patched
DataSet */
A_UINT32 data_type; /* DSET_TYPE_*, above */
u32 data_type; /* DSET_TYPE_*, above */
void *AuxPtr; /* Additional data that might
needed for data_type. For

View File

@ -81,8 +81,8 @@
* This allows for patches to be stored in flash.
*/
PREPACK struct patch_s {
A_UINT32 *address;
A_UINT32 data;
u32 *address;
u32 data;
} POSTPACK ;
/*
@ -92,23 +92,23 @@ PREPACK struct patch_s {
* patch code. The "data" in a PATCH_SKIP tells how many
* bytes of length "patch_s" to skip.
*/
#define PATCH_SKIP ((A_UINT32 *)0x00000000)
#define PATCH_SKIP ((u32 *)0x00000000)
/*
* Execute code at the address specified by "data".
* The address of the patch structure is passed as
* the one parameter.
*/
#define PATCH_CODE_ABS ((A_UINT32 *)0x00000001)
#define PATCH_CODE_ABS ((u32 *)0x00000001)
/*
* Same as PATCH_CODE_ABS, but treat "data" as an
* offset from the start of the patch word.
*/
#define PATCH_CODE_REL ((A_UINT32 *)0x00000002)
#define PATCH_CODE_REL ((u32 *)0x00000002)
/* Mark the end of this patch DataSet. */
#define PATCH_END ((A_UINT32 *)0xffffffff)
#define PATCH_END ((u32 *)0xffffffff)
/*
* A DataSet which contains a Binary Patch to some other DataSet

View File

@ -30,7 +30,7 @@
#endif
/* alignment to 4-bytes */
#define EPPING_ALIGNMENT_PAD (((sizeof(HTC_FRAME_HDR) + 3) & (~0x3)) - sizeof(HTC_FRAME_HDR))
#define EPPING_ALIGNMENT_PAD (((sizeof(struct htc_frame_hdr) + 3) & (~0x3)) - sizeof(struct htc_frame_hdr))
#ifndef A_OFFSETOF
#define A_OFFSETOF(type,field) (int)(&(((type *)NULL)->field))
@ -41,28 +41,28 @@
#define HCI_RSVD_EXPECTED_PKT_TYPE_RECV_OFFSET 7
typedef PREPACK struct {
A_UINT8 _HCIRsvd[8]; /* reserved for HCI packet header (GMBOX) testing */
A_UINT8 StreamEcho_h; /* stream no. to echo this packet on (filled by host) */
A_UINT8 StreamEchoSent_t; /* stream no. packet was echoed to (filled by target)
u8 _HCIRsvd[8]; /* reserved for HCI packet header (GMBOX) testing */
u8 StreamEcho_h; /* stream no. to echo this packet on (filled by host) */
u8 StreamEchoSent_t; /* stream no. packet was echoed to (filled by target)
When echoed: StreamEchoSent_t == StreamEcho_h */
A_UINT8 StreamRecv_t; /* stream no. that target received this packet on (filled by target) */
A_UINT8 StreamNo_h; /* stream number to send on (filled by host) */
A_UINT8 Magic_h[4]; /* magic number to filter for this packet on the host*/
A_UINT8 _rsvd[6]; /* reserved fields that must be set to a "reserved" value
u8 StreamRecv_t; /* stream no. that target received this packet on (filled by target) */
u8 StreamNo_h; /* stream number to send on (filled by host) */
u8 Magic_h[4]; /* magic number to filter for this packet on the host*/
u8 _rsvd[6]; /* reserved fields that must be set to a "reserved" value
since this packet maps to a 14-byte ethernet frame we want
to make sure ethertype field is set to something unknown */
A_UINT8 _pad[2]; /* padding for alignment */
A_UINT8 TimeStamp[8]; /* timestamp of packet (host or target) */
A_UINT32 HostContext_h; /* 4 byte host context, target echos this back */
A_UINT32 SeqNo; /* sequence number (set by host or target) */
A_UINT16 Cmd_h; /* ping command (filled by host) */
A_UINT16 CmdFlags_h; /* optional flags */
A_UINT8 CmdBuffer_h[8]; /* buffer for command (host -> target) */
A_UINT8 CmdBuffer_t[8]; /* buffer for command (target -> host) */
A_UINT16 DataLength; /* length of data */
A_UINT16 DataCRC; /* 16 bit CRC of data */
A_UINT16 HeaderCRC; /* header CRC (fields : StreamNo_h to end, minus HeaderCRC) */
u8 _pad[2]; /* padding for alignment */
u8 TimeStamp[8]; /* timestamp of packet (host or target) */
u32 HostContext_h; /* 4 byte host context, target echos this back */
u32 SeqNo; /* sequence number (set by host or target) */
u16 Cmd_h; /* ping command (filled by host) */
u16 CmdFlags_h; /* optional flags */
u8 CmdBuffer_h[8]; /* buffer for command (host -> target) */
u8 CmdBuffer_t[8]; /* buffer for command (target -> host) */
u16 DataLength; /* length of data */
u16 DataCRC; /* 16 bit CRC of data */
u16 HeaderCRC; /* header CRC (fields : StreamNo_h to end, minus HeaderCRC) */
} POSTPACK EPPING_HEADER;
#define EPPING_PING_MAGIC_0 0xAA
@ -97,9 +97,9 @@ typedef PREPACK struct {
/* test command parameters may be no more than 8 bytes */
typedef PREPACK struct {
A_UINT16 BurstCnt; /* number of packets to burst together (for HTC 2.1 testing) */
A_UINT16 PacketLength; /* length of packet to generate including header */
A_UINT16 Flags; /* flags */
u16 BurstCnt; /* number of packets to burst together (for HTC 2.1 testing) */
u16 PacketLength; /* length of packet to generate including header */
u16 Flags; /* flags */
#define EPPING_CONT_RX_DATA_CRC (1 << 0) /* Add CRC to all data */
#define EPPING_CONT_RX_RANDOM_DATA (1 << 1) /* randomize the data pattern */
@ -107,7 +107,7 @@ typedef PREPACK struct {
} POSTPACK EPPING_CONT_RX_PARAMS;
#define EPPING_HDR_CRC_OFFSET A_OFFSETOF(EPPING_HEADER,StreamNo_h)
#define EPPING_HDR_BYTES_CRC (sizeof(EPPING_HEADER) - EPPING_HDR_CRC_OFFSET - (sizeof(A_UINT16)))
#define EPPING_HDR_BYTES_CRC (sizeof(EPPING_HEADER) - EPPING_HDR_CRC_OFFSET - (sizeof(u16)))
#define HCI_TRANSPORT_STREAM_NUM 16 /* this number is higher than the define WMM AC classes so we
can use this to distinguish packets */

View File

@ -41,23 +41,23 @@
/* definitions for BT HCI packets */
typedef PREPACK struct {
A_UINT16 Flags_ConnHandle;
A_UINT16 Length;
u16 Flags_ConnHandle;
u16 Length;
} POSTPACK BT_HCI_ACL_HEADER;
typedef PREPACK struct {
A_UINT16 Flags_ConnHandle;
A_UINT8 Length;
u16 Flags_ConnHandle;
u8 Length;
} POSTPACK BT_HCI_SCO_HEADER;
typedef PREPACK struct {
A_UINT16 OpCode;
A_UINT8 ParamLength;
u16 OpCode;
u8 ParamLength;
} POSTPACK BT_HCI_COMMAND_HEADER;
typedef PREPACK struct {
A_UINT8 EventCode;
A_UINT8 ParamLength;
u8 EventCode;
u8 ParamLength;
} POSTPACK BT_HCI_EVENT_HEADER;
/* MBOX host interrupt signal assignments */

View File

@ -31,7 +31,7 @@
#define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field))
#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
(((A_UINT16)(((A_UINT8 *)(p))[(highbyte)])) << 8 | (A_UINT16)(((A_UINT8 *)(p))[(lowbyte)]))
(((u16)(((u8 *)(p))[(highbyte)])) << 8 | (u16)(((u8 *)(p))[(lowbyte)]))
/* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a
* structure using only the type and field name.
@ -43,15 +43,15 @@
#define A_SET_UINT16_FIELD(p,type,field,value) \
{ \
((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (A_UINT8)(value); \
((A_UINT8 *)(p))[A_OFFSETOF(type,field) + 1] = (A_UINT8)((value) >> 8); \
((u8 *)(p))[A_OFFSETOF(type,field)] = (u8)(value); \
((u8 *)(p))[A_OFFSETOF(type,field) + 1] = (u8)((value) >> 8); \
}
#define A_GET_UINT8_FIELD(p,type,field) \
((A_UINT8 *)(p))[A_OFFSETOF(type,field)]
((u8 *)(p))[A_OFFSETOF(type,field)]
#define A_SET_UINT8_FIELD(p,type,field,value) \
((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (value)
((u8 *)(p))[A_OFFSETOF(type,field)] = (value)
/****** DANGER DANGER ***************
*
@ -66,20 +66,20 @@
*/
/* HTC frame header */
typedef PREPACK struct _HTC_FRAME_HDR{
PREPACK struct htc_frame_hdr {
/* do not remove or re-arrange these fields, these are minimally required
* to take advantage of 4-byte lookaheads in some hardware implementations */
A_UINT8 EndpointID;
A_UINT8 Flags;
A_UINT16 PayloadLen; /* length of data (including trailer) that follows the header */
u8 EndpointID;
u8 Flags;
u16 PayloadLen; /* length of data (including trailer) that follows the header */
/***** end of 4-byte lookahead ****/
A_UINT8 ControlBytes[2];
u8 ControlBytes[2];
/* message payload starts after the header */
} POSTPACK HTC_FRAME_HDR;
} POSTPACK;
/* frame header flags */
@ -94,9 +94,9 @@ typedef PREPACK struct _HTC_FRAME_HDR{
#define HTC_FLAGS_RECV_BUNDLE_CNT_MASK (0xF0) /* bits 7..4 */
#define HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT 4
#define HTC_HDR_LENGTH (sizeof(HTC_FRAME_HDR))
#define HTC_HDR_LENGTH (sizeof(struct htc_frame_hdr))
#define HTC_MAX_TRAILER_LENGTH 255
#define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(HTC_FRAME_HDR))
#define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(struct htc_frame_hdr))
/* HTC control message IDs */
@ -110,25 +110,25 @@ typedef PREPACK struct _HTC_FRAME_HDR{
/* base message ID header */
typedef PREPACK struct {
A_UINT16 MessageID;
u16 MessageID;
} POSTPACK HTC_UNKNOWN_MSG;
/* HTC ready message
* direction : target-to-host */
typedef PREPACK struct {
A_UINT16 MessageID; /* ID */
A_UINT16 CreditCount; /* number of credits the target can offer */
A_UINT16 CreditSize; /* size of each credit */
A_UINT8 MaxEndpoints; /* maximum number of endpoints the target has resources for */
A_UINT8 _Pad1;
u16 MessageID; /* ID */
u16 CreditCount; /* number of credits the target can offer */
u16 CreditSize; /* size of each credit */
u8 MaxEndpoints; /* maximum number of endpoints the target has resources for */
u8 _Pad1;
} POSTPACK HTC_READY_MSG;
/* extended HTC ready message */
typedef PREPACK struct {
HTC_READY_MSG Version2_0_Info; /* legacy version 2.0 information at the front... */
/* extended information */
A_UINT8 HTCVersion;
A_UINT8 MaxMsgsPerHTCBundle;
u8 HTCVersion;
u8 MaxMsgsPerHTCBundle;
} POSTPACK HTC_READY_EX_MSG;
#define HTC_VERSION_2P0 0x00
@ -139,9 +139,9 @@ typedef PREPACK struct {
/* connect service
* direction : host-to-target */
typedef PREPACK struct {
A_UINT16 MessageID;
A_UINT16 ServiceID; /* service ID of the service to connect to */
A_UINT16 ConnectionFlags; /* connection flags */
u16 MessageID;
u16 ServiceID; /* service ID of the service to connect to */
u16 ConnectionFlags; /* connection flags */
#define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when
the host needs credits */
@ -151,8 +151,8 @@ typedef PREPACK struct {
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3
A_UINT8 ServiceMetaLength; /* length of meta data that follows */
A_UINT8 _Pad1;
u8 ServiceMetaLength; /* length of meta data that follows */
u8 _Pad1;
/* service-specific meta data starts after the header */
@ -161,29 +161,29 @@ typedef PREPACK struct {
/* connect response
* direction : target-to-host */
typedef PREPACK struct {
A_UINT16 MessageID;
A_UINT16 ServiceID; /* service ID that the connection request was made */
A_UINT8 Status; /* service connection status */
A_UINT8 EndpointID; /* assigned endpoint ID */
A_UINT16 MaxMsgSize; /* maximum expected message size on this endpoint */
A_UINT8 ServiceMetaLength; /* length of meta data that follows */
A_UINT8 _Pad1;
u16 MessageID;
u16 ServiceID; /* service ID that the connection request was made */
u8 Status; /* service connection status */
u8 EndpointID; /* assigned endpoint ID */
u16 MaxMsgSize; /* maximum expected message size on this endpoint */
u8 ServiceMetaLength; /* length of meta data that follows */
u8 _Pad1;
/* service-specific meta data starts after the header */
} POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
typedef PREPACK struct {
A_UINT16 MessageID;
u16 MessageID;
/* currently, no other fields */
} POSTPACK HTC_SETUP_COMPLETE_MSG;
/* extended setup completion message */
typedef PREPACK struct {
A_UINT16 MessageID;
A_UINT32 SetupFlags;
A_UINT8 MaxMsgsPerBundledRecv;
A_UINT8 Rsvd[3];
u16 MessageID;
u32 SetupFlags;
u8 MaxMsgsPerBundledRecv;
u8 Rsvd[3];
} POSTPACK HTC_SETUP_COMPLETE_EX_MSG;
#define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV (1 << 0)
@ -204,19 +204,19 @@ typedef PREPACK struct {
#define HTC_RECORD_LOOKAHEAD_BUNDLE 3
typedef PREPACK struct {
A_UINT8 RecordID; /* Record ID */
A_UINT8 Length; /* Length of record */
u8 RecordID; /* Record ID */
u8 Length; /* Length of record */
} POSTPACK HTC_RECORD_HDR;
typedef PREPACK struct {
A_UINT8 EndpointID; /* Endpoint that owns these credits */
A_UINT8 Credits; /* credits to report since last report */
u8 EndpointID; /* Endpoint that owns these credits */
u8 Credits; /* credits to report since last report */
} POSTPACK HTC_CREDIT_REPORT;
typedef PREPACK struct {
A_UINT8 PreValid; /* pre valid guard */
A_UINT8 LookAhead[4]; /* 4 byte lookahead */
A_UINT8 PostValid; /* post valid guard */
u8 PreValid; /* pre valid guard */
u8 LookAhead[4]; /* 4 byte lookahead */
u8 PostValid; /* post valid guard */
/* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes.
* The PreValid bytes must equal the inverse of the PostValid byte */
@ -224,7 +224,7 @@ typedef PREPACK struct {
} POSTPACK HTC_LOOKAHEAD_REPORT;
typedef PREPACK struct {
A_UINT8 LookAhead[4]; /* 4 byte lookahead */
u8 LookAhead[4]; /* 4 byte lookahead */
} POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;
#ifndef ATH_TARGET

View File

@ -74,9 +74,9 @@ typedef enum {
} WHAL_INI_DATA_ID;
typedef PREPACK struct {
A_UINT16 freqIndex; // 1 - A mode 2 - B or G mode 0 - common
A_UINT16 offset;
A_UINT32 newValue;
u16 freqIndex; // 1 - A mode 2 - B or G mode 0 - common
u16 offset;
u32 newValue;
} POSTPACK INI_DSET_REG_OVERRIDE;
#endif

View File

@ -31,11 +31,11 @@ extern "C" {
/* Pkt log info */
typedef PREPACK struct pkt_log_t {
struct info_t {
A_UINT16 st;
A_UINT16 end;
A_UINT16 cur;
u16 st;
u16 end;
u16 cur;
}info[4096];
A_UINT16 last_idx;
u16 last_idx;
}POSTPACK PACKET_LOG;

View File

@ -42,10 +42,10 @@
* the diagnostic window.
*/
PREPACK struct register_dump_s {
A_UINT32 target_id; /* Target ID */
A_UINT32 assline; /* Line number (if assertion failure) */
A_UINT32 pc; /* Program Counter at time of exception */
A_UINT32 badvaddr; /* Virtual address causing exception */
u32 target_id; /* Target ID */
u32 assline; /* Line number (if assertion failure) */
u32 pc; /* Program Counter at time of exception */
u32 badvaddr; /* Virtual address causing exception */
CPU_exception_frame_t exc_frame; /* CPU-specific exception info */
/* Could copy top of stack here, too.... */

View File

@ -124,12 +124,12 @@ enum searchType {
* instance of table).
*/
typedef PREPACK struct dbMasterTable_t { /* Hold ptrs to Table data structures */
A_UCHAR numOfEntries;
A_CHAR entrySize; /* Entry size per table row */
A_CHAR searchType; /* Index based access or key based */
A_CHAR reserved[3]; /* for alignment */
A_UINT16 tableSize; /* Size of this table */
A_CHAR *dataPtr; /* Ptr to the actual Table */
u8 numOfEntries;
char entrySize; /* Entry size per table row */
char searchType; /* Index based access or key based */
char reserved[3]; /* for alignment */
u16 tableSize; /* Size of this table */
char *dataPtr; /* Ptr to the actual Table */
} POSTPACK dbMasterTable; /* Master table - table of tables */
@ -145,22 +145,22 @@ typedef PREPACK struct dbMasterTable_t { /* Hold ptrs to Table data structure
#define BMZERO {0,0} /* BMLEN zeros */
#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh) \
{((((_fa >= 0) && (_fa < 32)) ? (((A_UINT32) 1) << _fa) : 0) | \
(((_fb >= 0) && (_fb < 32)) ? (((A_UINT32) 1) << _fb) : 0) | \
(((_fc >= 0) && (_fc < 32)) ? (((A_UINT32) 1) << _fc) : 0) | \
(((_fd >= 0) && (_fd < 32)) ? (((A_UINT32) 1) << _fd) : 0) | \
(((_fe >= 0) && (_fe < 32)) ? (((A_UINT32) 1) << _fe) : 0) | \
(((_ff >= 0) && (_ff < 32)) ? (((A_UINT32) 1) << _ff) : 0) | \
(((_fg >= 0) && (_fg < 32)) ? (((A_UINT32) 1) << _fg) : 0) | \
(((_fh >= 0) && (_fh < 32)) ? (((A_UINT32) 1) << _fh) : 0)), \
((((_fa > 31) && (_fa < 64)) ? (((A_UINT32) 1) << (_fa - 32)) : 0) | \
(((_fb > 31) && (_fb < 64)) ? (((A_UINT32) 1) << (_fb - 32)) : 0) | \
(((_fc > 31) && (_fc < 64)) ? (((A_UINT32) 1) << (_fc - 32)) : 0) | \
(((_fd > 31) && (_fd < 64)) ? (((A_UINT32) 1) << (_fd - 32)) : 0) | \
(((_fe > 31) && (_fe < 64)) ? (((A_UINT32) 1) << (_fe - 32)) : 0) | \
(((_ff > 31) && (_ff < 64)) ? (((A_UINT32) 1) << (_ff - 32)) : 0) | \
(((_fg > 31) && (_fg < 64)) ? (((A_UINT32) 1) << (_fg - 32)) : 0) | \
(((_fh > 31) && (_fh < 64)) ? (((A_UINT32) 1) << (_fh - 32)) : 0))}
{((((_fa >= 0) && (_fa < 32)) ? (((u32) 1) << _fa) : 0) | \
(((_fb >= 0) && (_fb < 32)) ? (((u32) 1) << _fb) : 0) | \
(((_fc >= 0) && (_fc < 32)) ? (((u32) 1) << _fc) : 0) | \
(((_fd >= 0) && (_fd < 32)) ? (((u32) 1) << _fd) : 0) | \
(((_fe >= 0) && (_fe < 32)) ? (((u32) 1) << _fe) : 0) | \
(((_ff >= 0) && (_ff < 32)) ? (((u32) 1) << _ff) : 0) | \
(((_fg >= 0) && (_fg < 32)) ? (((u32) 1) << _fg) : 0) | \
(((_fh >= 0) && (_fh < 32)) ? (((u32) 1) << _fh) : 0)), \
((((_fa > 31) && (_fa < 64)) ? (((u32) 1) << (_fa - 32)) : 0) | \
(((_fb > 31) && (_fb < 64)) ? (((u32) 1) << (_fb - 32)) : 0) | \
(((_fc > 31) && (_fc < 64)) ? (((u32) 1) << (_fc - 32)) : 0) | \
(((_fd > 31) && (_fd < 64)) ? (((u32) 1) << (_fd - 32)) : 0) | \
(((_fe > 31) && (_fe < 64)) ? (((u32) 1) << (_fe - 32)) : 0) | \
(((_ff > 31) && (_ff < 64)) ? (((u32) 1) << (_ff - 32)) : 0) | \
(((_fg > 31) && (_fg < 64)) ? (((u32) 1) << (_fg - 32)) : 0) | \
(((_fh > 31) && (_fh < 64)) ? (((u32) 1) << (_fh - 32)) : 0))}
/*
@ -169,12 +169,12 @@ typedef PREPACK struct dbMasterTable_t { /* Hold ptrs to Table data structure
*/
typedef PREPACK struct reg_dmn_pair_mapping {
A_UINT16 regDmnEnum; /* 16 bit reg domain pair */
A_UINT16 regDmn5GHz; /* 5GHz reg domain */
A_UINT16 regDmn2GHz; /* 2GHz reg domain */
A_UINT8 flags5GHz; /* Requirements flags (AdHoc disallow etc) */
A_UINT8 flags2GHz; /* Requirements flags (AdHoc disallow etc) */
A_UINT32 pscanMask; /* Passive Scan flags which can override unitary domain passive scan
u16 regDmnEnum; /* 16 bit reg domain pair */
u16 regDmn5GHz; /* 5GHz reg domain */
u16 regDmn2GHz; /* 2GHz reg domain */
u8 flags5GHz; /* Requirements flags (AdHoc disallow etc) */
u8 flags2GHz; /* Requirements flags (AdHoc disallow etc) */
u32 pscanMask; /* Passive Scan flags which can override unitary domain passive scan
flags. This value is used as a mask on the unitary flags*/
} POSTPACK REG_DMN_PAIR_MAPPING;
@ -188,10 +188,10 @@ typedef PREPACK struct reg_dmn_pair_mapping {
#define MCS_HT40_G_NO (0 << 3)
typedef PREPACK struct {
A_UINT16 countryCode;
A_UINT16 regDmnEnum;
A_CHAR isoName[3];
A_CHAR allowMode; /* what mode is allowed - bit 0: OFDM; bit 1: MCS_HT20; bit 2: MCS_HT40_A; bit 3: MCS_HT40_G */
u16 countryCode;
u16 regDmnEnum;
char isoName[3];
char allowMode; /* what mode is allowed - bit 0: OFDM; bit 1: MCS_HT20; bit 2: MCS_HT40_A; bit 3: MCS_HT40_G */
} POSTPACK COUNTRY_CODE_TO_ENUM_RD;
/* lower 16 bits of ht40ChanMask */
@ -209,29 +209,29 @@ typedef PREPACK struct {
#define FREQ_QUARTER_RATE 0x20000
typedef PREPACK struct RegDmnFreqBand {
A_UINT16 lowChannel; /* Low channel center in MHz */
A_UINT16 highChannel; /* High Channel center in MHz */
A_UINT8 power; /* Max power (dBm) for channel range */
A_UINT8 channelSep; /* Channel separation within the band */
A_UINT8 useDfs; /* Use DFS in the RegDomain if corresponding bit is set */
A_UINT8 mode; /* Mode of operation */
A_UINT32 usePassScan; /* Use Passive Scan in the RegDomain if corresponding bit is set */
A_UINT32 ht40ChanMask; /* lower 16 bits: indicate which frequencies in the block is HT40 capable
u16 lowChannel; /* Low channel center in MHz */
u16 highChannel; /* High Channel center in MHz */
u8 power; /* Max power (dBm) for channel range */
u8 channelSep; /* Channel separation within the band */
u8 useDfs; /* Use DFS in the RegDomain if corresponding bit is set */
u8 mode; /* Mode of operation */
u32 usePassScan; /* Use Passive Scan in the RegDomain if corresponding bit is set */
u32 ht40ChanMask; /* lower 16 bits: indicate which frequencies in the block is HT40 capable
upper 16 bits: what rate (half/quarter) the channel is */
} POSTPACK REG_DMN_FREQ_BAND;
typedef PREPACK struct regDomain {
A_UINT16 regDmnEnum; /* value from EnumRd table */
A_UINT8 rdCTL;
A_UINT8 maxAntGain;
A_UINT8 dfsMask; /* DFS bitmask for 5Ghz tables */
A_UINT8 flags; /* Requirement flags (AdHoc disallow etc) */
A_UINT16 reserved; /* for alignment */
A_UINT32 pscan; /* Bitmask for passive scan */
A_UINT32 chan11a[BMLEN]; /* 64 bit bitmask for channel/band selection */
A_UINT32 chan11bg[BMLEN];/* 64 bit bitmask for channel/band selection */
u16 regDmnEnum; /* value from EnumRd table */
u8 rdCTL;
u8 maxAntGain;
u8 dfsMask; /* DFS bitmask for 5Ghz tables */
u8 flags; /* Requirement flags (AdHoc disallow etc) */
u16 reserved; /* for alignment */
u32 pscan; /* Bitmask for passive scan */
u32 chan11a[BMLEN]; /* 64 bit bitmask for channel/band selection */
u32 chan11bg[BMLEN];/* 64 bit bitmask for channel/band selection */
} POSTPACK REG_DOMAIN;
#endif /* __REG_DBSCHEMA_H__ */

View File

@ -83,13 +83,13 @@ PREPACK struct host_interest_s {
* Pointer to application-defined area, if any.
* Set by Target application during startup.
*/
A_UINT32 hi_app_host_interest; /* 0x00 */
u32 hi_app_host_interest; /* 0x00 */
/* Pointer to register dump area, valid after Target crash. */
A_UINT32 hi_failure_state; /* 0x04 */
u32 hi_failure_state; /* 0x04 */
/* Pointer to debug logging header */
A_UINT32 hi_dbglog_hdr; /* 0x08 */
u32 hi_dbglog_hdr; /* 0x08 */
/* Indicates whether or not flash is present on Target.
* NB: flash_is_present indicator is here not just
@ -99,36 +99,36 @@ PREPACK struct host_interest_s {
* so that it doesn't get reinitialized with the rest
* of data.
*/
A_UINT32 hi_flash_is_present; /* 0x0c */
u32 hi_flash_is_present; /* 0x0c */
/*
* General-purpose flag bits, similar to AR6000_OPTION_* flags.
* Can be used by application rather than by OS.
*/
A_UINT32 hi_option_flag; /* 0x10 */
u32 hi_option_flag; /* 0x10 */
/*
* Boolean that determines whether or not to
* display messages on the serial port.
*/
A_UINT32 hi_serial_enable; /* 0x14 */
u32 hi_serial_enable; /* 0x14 */
/* Start address of Flash DataSet index, if any */
A_UINT32 hi_dset_list_head; /* 0x18 */
u32 hi_dset_list_head; /* 0x18 */
/* Override Target application start address */
A_UINT32 hi_app_start; /* 0x1c */
u32 hi_app_start; /* 0x1c */
/* Clock and voltage tuning */
A_UINT32 hi_skip_clock_init; /* 0x20 */
A_UINT32 hi_core_clock_setting; /* 0x24 */
A_UINT32 hi_cpu_clock_setting; /* 0x28 */
A_UINT32 hi_system_sleep_setting; /* 0x2c */
A_UINT32 hi_xtal_control_setting; /* 0x30 */
A_UINT32 hi_pll_ctrl_setting_24ghz; /* 0x34 */
A_UINT32 hi_pll_ctrl_setting_5ghz; /* 0x38 */
A_UINT32 hi_ref_voltage_trim_setting; /* 0x3c */
A_UINT32 hi_clock_info; /* 0x40 */
u32 hi_skip_clock_init; /* 0x20 */
u32 hi_core_clock_setting; /* 0x24 */
u32 hi_cpu_clock_setting; /* 0x28 */
u32 hi_system_sleep_setting; /* 0x2c */
u32 hi_xtal_control_setting; /* 0x30 */
u32 hi_pll_ctrl_setting_24ghz; /* 0x34 */
u32 hi_pll_ctrl_setting_5ghz; /* 0x38 */
u32 hi_ref_voltage_trim_setting; /* 0x3c */
u32 hi_clock_info; /* 0x40 */
/*
* Flash configuration overrides, used only
@ -136,49 +136,49 @@ PREPACK struct host_interest_s {
* (When using flash, modify the global variables
* with equivalent names.)
*/
A_UINT32 hi_bank0_addr_value; /* 0x44 */
A_UINT32 hi_bank0_read_value; /* 0x48 */
A_UINT32 hi_bank0_write_value; /* 0x4c */
A_UINT32 hi_bank0_config_value; /* 0x50 */
u32 hi_bank0_addr_value; /* 0x44 */
u32 hi_bank0_read_value; /* 0x48 */
u32 hi_bank0_write_value; /* 0x4c */
u32 hi_bank0_config_value; /* 0x50 */
/* Pointer to Board Data */
A_UINT32 hi_board_data; /* 0x54 */
A_UINT32 hi_board_data_initialized; /* 0x58 */
u32 hi_board_data; /* 0x54 */
u32 hi_board_data_initialized; /* 0x58 */
A_UINT32 hi_dset_RAM_index_table; /* 0x5c */
u32 hi_dset_RAM_index_table; /* 0x5c */
A_UINT32 hi_desired_baud_rate; /* 0x60 */
A_UINT32 hi_dbglog_config; /* 0x64 */
A_UINT32 hi_end_RAM_reserve_sz; /* 0x68 */
A_UINT32 hi_mbox_io_block_sz; /* 0x6c */
u32 hi_desired_baud_rate; /* 0x60 */
u32 hi_dbglog_config; /* 0x64 */
u32 hi_end_RAM_reserve_sz; /* 0x68 */
u32 hi_mbox_io_block_sz; /* 0x6c */
A_UINT32 hi_num_bpatch_streams; /* 0x70 -- unused */
A_UINT32 hi_mbox_isr_yield_limit; /* 0x74 */
u32 hi_num_bpatch_streams; /* 0x70 -- unused */
u32 hi_mbox_isr_yield_limit; /* 0x74 */
A_UINT32 hi_refclk_hz; /* 0x78 */
A_UINT32 hi_ext_clk_detected; /* 0x7c */
A_UINT32 hi_dbg_uart_txpin; /* 0x80 */
A_UINT32 hi_dbg_uart_rxpin; /* 0x84 */
A_UINT32 hi_hci_uart_baud; /* 0x88 */
A_UINT32 hi_hci_uart_pin_assignments; /* 0x8C */
u32 hi_refclk_hz; /* 0x78 */
u32 hi_ext_clk_detected; /* 0x7c */
u32 hi_dbg_uart_txpin; /* 0x80 */
u32 hi_dbg_uart_rxpin; /* 0x84 */
u32 hi_hci_uart_baud; /* 0x88 */
u32 hi_hci_uart_pin_assignments; /* 0x8C */
/* NOTE: byte [0] = tx pin, [1] = rx pin, [2] = rts pin, [3] = cts pin */
A_UINT32 hi_hci_uart_baud_scale_val; /* 0x90 */
A_UINT32 hi_hci_uart_baud_step_val; /* 0x94 */
u32 hi_hci_uart_baud_scale_val; /* 0x90 */
u32 hi_hci_uart_baud_step_val; /* 0x94 */
A_UINT32 hi_allocram_start; /* 0x98 */
A_UINT32 hi_allocram_sz; /* 0x9c */
A_UINT32 hi_hci_bridge_flags; /* 0xa0 */
A_UINT32 hi_hci_uart_support_pins; /* 0xa4 */
u32 hi_allocram_start; /* 0x98 */
u32 hi_allocram_sz; /* 0x9c */
u32 hi_hci_bridge_flags; /* 0xa0 */
u32 hi_hci_uart_support_pins; /* 0xa4 */
/* NOTE: byte [0] = RESET pin (bit 7 is polarity), bytes[1]..bytes[3] are for future use */
A_UINT32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */
u32 hi_hci_uart_pwr_mgmt_params; /* 0xa8 */
/* 0xa8 - [0]: 1 = enable, 0 = disable
* [1]: 0 = UART FC active low, 1 = UART FC active high
* 0xa9 - [7:0]: wakeup timeout in ms
* 0xaa, 0xab - [15:0]: idle timeout in ms
*/
/* Pointer to extended board Data */
A_UINT32 hi_board_ext_data; /* 0xac */
A_UINT32 hi_board_ext_data_initialized; /* 0xb0 */
u32 hi_board_ext_data; /* 0xac */
u32 hi_board_ext_data_initialized; /* 0xb0 */
} POSTPACK;
/* Bits defined in hi_option_flag */
@ -207,10 +207,10 @@ PREPACK struct host_interest_s {
* Example: target_addr = AR6002_HOST_INTEREST_ITEM_ADDRESS(hi_board_data);
*/
#define AR6002_HOST_INTEREST_ITEM_ADDRESS(item) \
(A_UINT32)((unsigned long)&((((struct host_interest_s *)(AR6002_HOST_INTEREST_ADDRESS))->item)))
(u32)((unsigned long)&((((struct host_interest_s *)(AR6002_HOST_INTEREST_ADDRESS))->item)))
#define AR6003_HOST_INTEREST_ITEM_ADDRESS(item) \
(A_UINT32)((unsigned long)&((((struct host_interest_s *)(AR6003_HOST_INTEREST_ADDRESS))->item)))
(u32)((unsigned long)&((((struct host_interest_s *)(AR6003_HOST_INTEREST_ADDRESS))->item)))
#define HOST_INTEREST_DBGLOG_IS_ENABLED() \
(!(HOST_INTEREST->hi_option_flag & HI_OPTION_DISABLE_DBGLOG))
@ -233,7 +233,7 @@ PREPACK struct host_interest_s {
#define AR6003_BOARD_EXT_DATA_ADDRESS 0x57E600
/* # of A_UINT32 entries in targregs, used by DIAG_FETCH_TARG_REGS */
/* # of u32 entries in targregs, used by DIAG_FETCH_TARG_REGS */
#define AR6003_FETCH_TARG_REGS_COUNT 64
#endif /* !__ASSEMBLER__ */

View File

@ -82,20 +82,20 @@ typedef enum {
} TCMD_WLAN_MODE;
typedef PREPACK struct {
A_UINT32 testCmdId;
A_UINT32 mode;
A_UINT32 freq;
A_UINT32 dataRate;
A_INT32 txPwr;
A_UINT32 antenna;
A_UINT32 enANI;
A_UINT32 scramblerOff;
A_UINT32 aifsn;
A_UINT16 pktSz;
A_UINT16 txPattern;
A_UINT32 shortGuard;
A_UINT32 numPackets;
A_UINT32 wlanMode;
u32 testCmdId;
u32 mode;
u32 freq;
u32 dataRate;
s32 txPwr;
u32 antenna;
u32 enANI;
u32 scramblerOff;
u32 aifsn;
u16 pktSz;
u16 txPattern;
u32 shortGuard;
u32 numPackets;
u32 wlanMode;
} POSTPACK TCMD_CONT_TX;
#define TCMD_TXPATTERN_ZERONE 0x1
@ -124,29 +124,29 @@ typedef enum {
} TCMD_CONT_RX_ACT;
typedef PREPACK struct {
A_UINT32 testCmdId;
A_UINT32 act;
A_UINT32 enANI;
u32 testCmdId;
u32 act;
u32 enANI;
PREPACK union {
struct PREPACK TCMD_CONT_RX_PARA {
A_UINT32 freq;
A_UINT32 antenna;
A_UINT32 wlanMode;
u32 freq;
u32 antenna;
u32 wlanMode;
} POSTPACK para;
struct PREPACK TCMD_CONT_RX_REPORT {
A_UINT32 totalPkt;
A_INT32 rssiInDBm;
A_UINT32 crcErrPkt;
A_UINT32 secErrPkt;
A_UINT16 rateCnt[TCMD_MAX_RATES];
A_UINT16 rateCntShortGuard[TCMD_MAX_RATES];
u32 totalPkt;
s32 rssiInDBm;
u32 crcErrPkt;
u32 secErrPkt;
u16 rateCnt[TCMD_MAX_RATES];
u16 rateCntShortGuard[TCMD_MAX_RATES];
} POSTPACK report;
struct PREPACK TCMD_CONT_RX_MAC {
A_UCHAR addr[ATH_MAC_LEN];
u8 addr[ATH_MAC_LEN];
} POSTPACK mac;
struct PREPACK TCMD_CONT_RX_ANT_SWITCH_TABLE {
A_UINT32 antswitch1;
A_UINT32 antswitch2;
u32 antswitch1;
u32 antswitch2;
}POSTPACK antswitchtable;
} POSTPACK u;
} POSTPACK TCMD_CONT_RX;
@ -162,8 +162,8 @@ typedef enum {
} TCMD_PM_MODE;
typedef PREPACK struct {
A_UINT32 testCmdId;
A_UINT32 mode;
u32 testCmdId;
u32 mode;
} POSTPACK TCMD_PM;
typedef enum {

View File

@ -25,9 +25,9 @@
typedef PREPACK struct wow_config_dset {
A_UINT8 valid_dset;
A_UINT8 gpio_enable;
A_UINT16 gpio_pin;
u8 valid_dset;
u8 gpio_enable;
u16 gpio_pin;
} POSTPACK WOW_CONFIG_DSET;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -101,9 +101,9 @@ typedef enum{
* disabled by default but can be enabled using this structure and the
* WMI_THIN_CONFIG_CMDID. */
typedef PREPACK struct {
A_UINT8 version; /* the versioned type of messages to use or 0 to disable */
A_UINT8 countThreshold; /* msg count threshold triggering a tx complete message */
A_UINT16 timeThreshold; /* timeout interval in MSEC triggering a tx complete message */
u8 version; /* the versioned type of messages to use or 0 to disable */
u8 countThreshold; /* msg count threshold triggering a tx complete message */
u16 timeThreshold; /* timeout interval in MSEC triggering a tx complete message */
} POSTPACK WMI_THIN_CONFIG_TXCOMPLETE;
/* WMI_THIN_CONFIG_DECRYPT_ERR -- Used to configure behavior for received frames
@ -111,22 +111,22 @@ typedef PREPACK struct {
* without notification. Alternately, the MAC Header is forwarded to the host
* with the failed status. */
typedef PREPACK struct {
A_UINT8 enable; /* 1 == send decrypt errors to the host, 0 == don't */
A_UINT8 reserved[3]; /* align padding */
u8 enable; /* 1 == send decrypt errors to the host, 0 == don't */
u8 reserved[3]; /* align padding */
} POSTPACK WMI_THIN_CONFIG_DECRYPT_ERR;
/* WMI_THIN_CONFIG_TX_MAC_RULES -- Used to configure behavior for transmitted
* frames that require partial MAC header construction. These rules
* are used by the target to indicate which fields need to be written. */
typedef PREPACK struct {
A_UINT32 rules; /* combination of WMI_WRT_... values */
u32 rules; /* combination of WMI_WRT_... values */
} POSTPACK WMI_THIN_CONFIG_TX_MAC_RULES;
/* WMI_THIN_CONFIG_RX_FILTER_RULES -- Used to configure behavior for received
* frames as to which frames should get forwarded to the host and which
* should get processed internally. */
typedef PREPACK struct {
A_UINT32 rules; /* combination of WMI_FILT_... values */
u32 rules; /* combination of WMI_FILT_... values */
} POSTPACK WMI_THIN_CONFIG_RX_FILTER_RULES;
/* WMI_THIN_CONFIG_CMD -- Used to contain some combination of the above
@ -138,9 +138,9 @@ typedef PREPACK struct {
#define WMI_THIN_CFG_DECRYPT 0x00000002
#define WMI_THIN_CFG_MAC_RULES 0x00000004
#define WMI_THIN_CFG_FILTER_RULES 0x00000008
A_UINT32 cfgField; /* combination of WMI_THIN_CFG_... describes contents of config command */
A_UINT16 length; /* length in bytes of appended sub-commands */
A_UINT8 reserved[2]; /* align padding */
u32 cfgField; /* combination of WMI_THIN_CFG_... describes contents of config command */
u16 length; /* length in bytes of appended sub-commands */
u8 reserved[2]; /* align padding */
} POSTPACK WMI_THIN_CONFIG_CMD;
/* MIB Access Identifiers tailored for Symbian. */
@ -176,35 +176,35 @@ enum {
};
typedef PREPACK struct {
A_UINT8 addr[ATH_MAC_LEN];
u8 addr[ATH_MAC_LEN];
} POSTPACK WMI_THIN_MIB_STA_MAC;
typedef PREPACK struct {
A_UINT32 time; // units == msec
u32 time; // units == msec
} POSTPACK WMI_THIN_MIB_RX_LIFE_TIME;
typedef PREPACK struct {
A_UINT8 enable; //1 = on, 0 = off
u8 enable; //1 = on, 0 = off
} POSTPACK WMI_THIN_MIB_CTS_TO_SELF;
typedef PREPACK struct {
A_UINT32 time; // units == usec
u32 time; // units == usec
} POSTPACK WMI_THIN_MIB_SLOT_TIME;
typedef PREPACK struct {
A_UINT16 length; //units == bytes
u16 length; //units == bytes
} POSTPACK WMI_THIN_MIB_RTS_THRESHOLD;
typedef PREPACK struct {
A_UINT8 type; // type of frame
A_UINT8 rate; // tx rate to be used (one of WMI_BIT_RATE)
A_UINT16 length; // num bytes following this structure as the template data
u8 type; // type of frame
u8 rate; // tx rate to be used (one of WMI_BIT_RATE)
u16 length; // num bytes following this structure as the template data
} POSTPACK WMI_THIN_MIB_TEMPLATE_FRAME;
typedef PREPACK struct {
#define FRAME_FILTER_PROMISCUOUS 0x00000001
#define FRAME_FILTER_BSSID 0x00000002
A_UINT32 filterMask;
u32 filterMask;
} POSTPACK WMI_THIN_MIB_RXFRAME_FILTER;
@ -212,110 +212,110 @@ typedef PREPACK struct {
#define IE_FILTER_TREATMENT_APPEAR 2
typedef PREPACK struct {
A_UINT8 ie;
A_UINT8 treatment;
u8 ie;
u8 treatment;
} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE;
typedef PREPACK struct {
A_UINT8 ie;
A_UINT8 treatment;
A_UINT8 oui[3];
A_UINT8 type;
A_UINT16 version;
u8 ie;
u8 treatment;
u8 oui[3];
u8 type;
u16 version;
} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_OUI;
typedef PREPACK struct {
A_UINT16 numElements;
A_UINT8 entrySize; // sizeof(WMI_THIN_MIB_BEACON_FILTER_TABLE) on host cpu may be 2 may be 4
A_UINT8 reserved;
u16 numElements;
u8 entrySize; // sizeof(WMI_THIN_MIB_BEACON_FILTER_TABLE) on host cpu may be 2 may be 4
u8 reserved;
} POSTPACK WMI_THIN_MIB_BEACON_FILTER_TABLE_HEADER;
typedef PREPACK struct {
A_UINT32 count; /* num beacons between deliveries */
A_UINT8 enable;
A_UINT8 reserved[3];
u32 count; /* num beacons between deliveries */
u8 enable;
u8 reserved[3];
} POSTPACK WMI_THIN_MIB_BEACON_FILTER;
typedef PREPACK struct {
A_UINT32 count; /* num consec lost beacons after which send event */
u32 count; /* num consec lost beacons after which send event */
} POSTPACK WMI_THIN_MIB_BEACON_LOST_COUNT;
typedef PREPACK struct {
A_UINT8 rssi; /* the low threshold which can trigger an event warning */
A_UINT8 tolerance; /* the range above and below the threshold to prevent event flooding to the host. */
A_UINT8 count; /* the sample count of consecutive frames necessary to trigger an event. */
A_UINT8 reserved[1]; /* padding */
u8 rssi; /* the low threshold which can trigger an event warning */
u8 tolerance; /* the range above and below the threshold to prevent event flooding to the host. */
u8 count; /* the sample count of consecutive frames necessary to trigger an event. */
u8 reserved[1]; /* padding */
} POSTPACK WMI_THIN_MIB_RSSI_THRESHOLD;
typedef PREPACK struct {
A_UINT32 cap;
A_UINT32 rxRateField;
A_UINT32 beamForming;
A_UINT8 addr[ATH_MAC_LEN];
A_UINT8 enable;
A_UINT8 stbc;
A_UINT8 maxAMPDU;
A_UINT8 msduSpacing;
A_UINT8 mcsFeedback;
A_UINT8 antennaSelCap;
u32 cap;
u32 rxRateField;
u32 beamForming;
u8 addr[ATH_MAC_LEN];
u8 enable;
u8 stbc;
u8 maxAMPDU;
u8 msduSpacing;
u8 mcsFeedback;
u8 antennaSelCap;
} POSTPACK WMI_THIN_MIB_HT_CAP;
typedef PREPACK struct {
A_UINT32 infoField;
A_UINT32 basicRateField;
A_UINT8 protection;
A_UINT8 secondChanneloffset;
A_UINT8 channelWidth;
A_UINT8 reserved;
u32 infoField;
u32 basicRateField;
u8 protection;
u8 secondChanneloffset;
u8 channelWidth;
u8 reserved;
} POSTPACK WMI_THIN_MIB_HT_OP;
typedef PREPACK struct {
#define SECOND_BEACON_PRIMARY 1
#define SECOND_BEACON_EITHER 2
#define SECOND_BEACON_SECONDARY 3
A_UINT8 cfg;
A_UINT8 reserved[3]; /* padding */
u8 cfg;
u8 reserved[3]; /* padding */
} POSTPACK WMI_THIN_MIB_HT_2ND_BEACON;
typedef PREPACK struct {
A_UINT8 txTIDField;
A_UINT8 rxTIDField;
A_UINT8 reserved[2]; /* padding */
u8 txTIDField;
u8 rxTIDField;
u8 reserved[2]; /* padding */
} POSTPACK WMI_THIN_MIB_HT_BLOCK_ACK;
typedef PREPACK struct {
A_UINT8 enableLong; // 1 == long preamble, 0 == short preamble
A_UINT8 reserved[3];
u8 enableLong; // 1 == long preamble, 0 == short preamble
u8 reserved[3];
} POSTPACK WMI_THIN_MIB_PREAMBLE;
typedef PREPACK struct {
A_UINT16 length; /* the length in bytes of the appended MIB data */
A_UINT8 mibID; /* the ID of the MIB element being set */
A_UINT8 reserved; /* align padding */
u16 length; /* the length in bytes of the appended MIB data */
u8 mibID; /* the ID of the MIB element being set */
u8 reserved; /* align padding */
} POSTPACK WMI_THIN_SET_MIB_CMD;
typedef PREPACK struct {
A_UINT8 mibID; /* the ID of the MIB element being set */
A_UINT8 reserved[3]; /* align padding */
u8 mibID; /* the ID of the MIB element being set */
u8 reserved[3]; /* align padding */
} POSTPACK WMI_THIN_GET_MIB_CMD;
typedef PREPACK struct {
A_UINT32 basicRateMask; /* bit mask of basic rates */
A_UINT32 beaconIntval; /* TUs */
A_UINT16 atimWindow; /* TUs */
A_UINT16 channel; /* frequency in Mhz */
A_UINT8 networkType; /* INFRA_NETWORK | ADHOC_NETWORK */
A_UINT8 ssidLength; /* 0 - 32 */
A_UINT8 probe; /* != 0 : issue probe req at start */
A_UINT8 reserved; /* alignment */
A_UCHAR ssid[WMI_MAX_SSID_LEN];
A_UINT8 bssid[ATH_MAC_LEN];
u32 basicRateMask; /* bit mask of basic rates */
u32 beaconIntval; /* TUs */
u16 atimWindow; /* TUs */
u16 channel; /* frequency in Mhz */
u8 networkType; /* INFRA_NETWORK | ADHOC_NETWORK */
u8 ssidLength; /* 0 - 32 */
u8 probe; /* != 0 : issue probe req at start */
u8 reserved; /* alignment */
u8 ssid[WMI_MAX_SSID_LEN];
u8 bssid[ATH_MAC_LEN];
} POSTPACK WMI_THIN_JOIN_CMD;
typedef PREPACK struct {
A_UINT16 dtim; /* dtim interval in num beacons */
A_UINT16 aid; /* 80211 AID from Assoc resp */
u16 dtim; /* dtim interval in num beacons */
u16 aid; /* 80211 AID from Assoc resp */
} POSTPACK WMI_THIN_POST_ASSOC_CMD;
typedef enum {
@ -336,8 +336,8 @@ typedef enum {
}WMI_THIN_JOIN_RESULT;
typedef PREPACK struct {
A_UINT8 result; /* the result of the join cmd. one of WMI_THIN_JOIN_RESULT */
A_UINT8 reserved[3]; /* alignment */
u8 result; /* the result of the join cmd. one of WMI_THIN_JOIN_RESULT */
u8 reserved[3]; /* alignment */
} POSTPACK WMI_THIN_JOIN_EVENT;
#ifdef __cplusplus

View File

@ -55,7 +55,7 @@ extern "C" {
* WMI_EVENT_ID=WMI_EXTENSION_EVENTID.
*/
typedef PREPACK struct {
A_UINT32 commandId;
u32 commandId;
} POSTPACK WMIX_CMD_HDR;
typedef enum {
@ -96,10 +96,10 @@ typedef enum {
* DataSet Open Request Event
*/
typedef PREPACK struct {
A_UINT32 dset_id;
A_UINT32 targ_dset_handle; /* echo'ed, not used by Host, */
A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */
A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */
u32 dset_id;
u32 targ_dset_handle; /* echo'ed, not used by Host, */
u32 targ_reply_fn; /* echo'ed, not used by Host, */
u32 targ_reply_arg; /* echo'ed, not used by Host, */
} POSTPACK WMIX_DSETOPENREQ_EVENT;
/*
@ -107,7 +107,7 @@ typedef PREPACK struct {
* DataSet Close Event
*/
typedef PREPACK struct {
A_UINT32 access_cookie;
u32 access_cookie;
} POSTPACK WMIX_DSETCLOSE_EVENT;
/*
@ -115,31 +115,31 @@ typedef PREPACK struct {
* DataSet Data Request Event
*/
typedef PREPACK struct {
A_UINT32 access_cookie;
A_UINT32 offset;
A_UINT32 length;
A_UINT32 targ_buf; /* echo'ed, not used by Host, */
A_UINT32 targ_reply_fn; /* echo'ed, not used by Host, */
A_UINT32 targ_reply_arg; /* echo'ed, not used by Host, */
u32 access_cookie;
u32 offset;
u32 length;
u32 targ_buf; /* echo'ed, not used by Host, */
u32 targ_reply_fn; /* echo'ed, not used by Host, */
u32 targ_reply_arg; /* echo'ed, not used by Host, */
} POSTPACK WMIX_DSETDATAREQ_EVENT;
typedef PREPACK struct {
A_UINT32 status;
A_UINT32 targ_dset_handle;
A_UINT32 targ_reply_fn;
A_UINT32 targ_reply_arg;
A_UINT32 access_cookie;
A_UINT32 size;
A_UINT32 version;
u32 status;
u32 targ_dset_handle;
u32 targ_reply_fn;
u32 targ_reply_arg;
u32 access_cookie;
u32 size;
u32 version;
} POSTPACK WMIX_DSETOPEN_REPLY_CMD;
typedef PREPACK struct {
A_UINT32 status;
A_UINT32 targ_buf;
A_UINT32 targ_reply_fn;
A_UINT32 targ_reply_arg;
A_UINT32 length;
A_UINT8 buf[1];
u32 status;
u32 targ_buf;
u32 targ_reply_fn;
u32 targ_reply_arg;
u32 length;
u8 buf[1];
} POSTPACK WMIX_DSETDATA_REPLY_CMD;
@ -160,10 +160,10 @@ typedef PREPACK struct {
* clear/disable or disable/enable, results are undefined.
*/
typedef PREPACK struct {
A_UINT32 set_mask; /* pins to set */
A_UINT32 clear_mask; /* pins to clear */
A_UINT32 enable_mask; /* pins to enable for output */
A_UINT32 disable_mask; /* pins to disable/tristate */
u32 set_mask; /* pins to set */
u32 clear_mask; /* pins to clear */
u32 enable_mask; /* pins to enable for output */
u32 disable_mask; /* pins to disable/tristate */
} POSTPACK WMIX_GPIO_OUTPUT_SET_CMD;
/*
@ -172,13 +172,13 @@ typedef PREPACK struct {
* platform-dependent header.
*/
typedef PREPACK struct {
A_UINT32 gpioreg_id; /* GPIO register ID */
A_UINT32 value; /* value to write */
u32 gpioreg_id; /* GPIO register ID */
u32 value; /* value to write */
} POSTPACK WMIX_GPIO_REGISTER_SET_CMD;
/* Get a GPIO register. For debug/exceptional cases. */
typedef PREPACK struct {
A_UINT32 gpioreg_id; /* GPIO register to read */
u32 gpioreg_id; /* GPIO register to read */
} POSTPACK WMIX_GPIO_REGISTER_GET_CMD;
/*
@ -187,7 +187,7 @@ typedef PREPACK struct {
* were delivered in an earlier WMIX_GPIO_INTR_EVENT message.
*/
typedef PREPACK struct {
A_UINT32 ack_mask; /* interrupts to acknowledge */
u32 ack_mask; /* interrupts to acknowledge */
} POSTPACK WMIX_GPIO_INTR_ACK_CMD;
/*
@ -197,8 +197,8 @@ typedef PREPACK struct {
* use of a GPIO interrupt as a Data Valid signal for other GPIO pins.
*/
typedef PREPACK struct {
A_UINT32 intr_mask; /* pending GPIO interrupts */
A_UINT32 input_values; /* recent GPIO input values */
u32 intr_mask; /* pending GPIO interrupts */
u32 input_values; /* recent GPIO input values */
} POSTPACK WMIX_GPIO_INTR_EVENT;
/*
@ -217,8 +217,8 @@ typedef PREPACK struct {
* simplify Host GPIO support.
*/
typedef PREPACK struct {
A_UINT32 value;
A_UINT32 reg_id;
u32 value;
u32 reg_id;
} POSTPACK WMIX_GPIO_DATA_EVENT;
/*
@ -230,8 +230,8 @@ typedef PREPACK struct {
* Heartbeat Challenge Response command
*/
typedef PREPACK struct {
A_UINT32 cookie;
A_UINT32 source;
u32 cookie;
u32 source;
} POSTPACK WMIX_HB_CHALLENGE_RESP_CMD;
/*
@ -249,12 +249,12 @@ typedef PREPACK struct {
*/
typedef PREPACK struct {
A_UINT32 period; /* Time (in 30.5us ticks) between samples */
A_UINT32 nbins;
u32 period; /* Time (in 30.5us ticks) between samples */
u32 nbins;
} POSTPACK WMIX_PROF_CFG_CMD;
typedef PREPACK struct {
A_UINT32 addr;
u32 addr;
} POSTPACK WMIX_PROF_ADDR_SET_CMD;
/*
@ -264,8 +264,8 @@ typedef PREPACK struct {
* count set to the corresponding count
*/
typedef PREPACK struct {
A_UINT32 addr;
A_UINT32 count;
u32 addr;
u32 count;
} POSTPACK WMIX_PROF_COUNT_EVENT;
#ifndef ATH_TARGET

View File

@ -29,23 +29,23 @@
/* structure that is the state information for the default credit distribution callback
* drivers should instantiate (zero-init as well) this structure in their driver instance
* and pass it as a context to the HTC credit distribution functions */
typedef struct _COMMON_CREDIT_STATE_INFO {
struct common_credit_state_info {
int TotalAvailableCredits; /* total credits in the system at startup */
int CurrentFreeCredits; /* credits available in the pool that have not been
given out to endpoints */
HTC_ENDPOINT_CREDIT_DIST *pLowestPriEpDist; /* pointer to the lowest priority endpoint dist struct */
} COMMON_CREDIT_STATE_INFO;
struct htc_endpoint_credit_dist *pLowestPriEpDist; /* pointer to the lowest priority endpoint dist struct */
};
typedef struct {
A_INT32 (*setupTransport)(void *ar);
struct hci_transport_callbacks {
s32 (*setupTransport)(void *ar);
void (*cleanupTransport)(void *ar);
} HCI_TRANSPORT_CALLBACKS;
};
typedef struct {
struct hci_transport_misc_handles {
void *netDevice;
void *hifDevice;
void *htcHandle;
} HCI_TRANSPORT_MISC_HANDLES;
};
/* HTC TX packet tagging definitions */
#define AR6K_CONTROL_PKT_TAG HTC_TX_PACKET_TAG_USER_DEFINED
@ -64,42 +64,42 @@ extern "C" {
#endif
/* OS-independent APIs */
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);
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 ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
int ar6000_WriteRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
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_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);
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_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 ar6000_prepare_target(HIF_DEVICE *hifDevice,
A_UINT32 TargetType,
A_UINT32 TargetVersion);
int ar6000_prepare_target(struct hif_device *hifDevice,
u32 TargetType,
u32 TargetVersion);
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);
void ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType);
void ar6000_copy_cust_data_from_target(struct hif_device *hifDevice, u32 TargetType);
A_UINT8 *ar6000_get_cust_data_buffer(A_UINT32 TargetType);
u8 *ar6000_get_cust_data_buffer(u32 TargetType);
A_STATUS ar6000_setBTState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
int ar6000_setBTState(void *context, u8 *pInBuf, u32 InBufSize);
A_STATUS ar6000_setDevicePowerState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
int ar6000_setDevicePowerState(void *context, u8 *pInBuf, u32 InBufSize);
A_STATUS ar6000_setWowMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
int ar6000_setWowMode(void *context, u8 *pInBuf, u32 InBufSize);
A_STATUS ar6000_setHostMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
int ar6000_setHostMode(void *context, u8 *pInBuf, u32 InBufSize);
#ifdef __cplusplus
}

View File

@ -32,10 +32,10 @@
/* list functions */
/* pointers for the list */
typedef struct _DL_LIST {
struct _DL_LIST *pPrev;
struct _DL_LIST *pNext;
}DL_LIST, *PDL_LIST;
struct dl_list {
struct dl_list *pPrev;
struct dl_list *pNext;
};
/*
* DL_LIST_INIT , initialize doubly linked list
*/
@ -67,7 +67,7 @@ typedef struct _DL_LIST {
*/
#define ITERATE_OVER_LIST_ALLOW_REMOVE(pStart,pItem,st,offset) \
{ \
PDL_LIST pTemp; \
struct dl_list * pTemp; \
pTemp = (pStart)->pNext; \
while (pTemp != (pStart)) { \
(pItem) = A_CONTAINING_STRUCT(pTemp,st,offset); \
@ -78,7 +78,7 @@ typedef struct _DL_LIST {
/*
* DL_ListInsertTail - insert pAdd to the end of the list
*/
static INLINE PDL_LIST DL_ListInsertTail(PDL_LIST pList, PDL_LIST pAdd) {
static INLINE struct dl_list *DL_ListInsertTail(struct dl_list *pList, struct dl_list *pAdd) {
/* insert at tail */
pAdd->pPrev = pList->pPrev;
pAdd->pNext = pList;
@ -90,7 +90,7 @@ static INLINE PDL_LIST DL_ListInsertTail(PDL_LIST pList, PDL_LIST pAdd) {
/*
* DL_ListInsertHead - insert pAdd into the head of the list
*/
static INLINE PDL_LIST DL_ListInsertHead(PDL_LIST pList, PDL_LIST pAdd) {
static INLINE struct dl_list * DL_ListInsertHead(struct dl_list * pList, struct dl_list * pAdd) {
/* insert at head */
pAdd->pPrev = pList;
pAdd->pNext = pList->pNext;
@ -103,7 +103,7 @@ static INLINE PDL_LIST DL_ListInsertHead(PDL_LIST pList, PDL_LIST pAdd) {
/*
* DL_ListRemove - remove pDel from list
*/
static INLINE PDL_LIST DL_ListRemove(PDL_LIST pDel) {
static INLINE struct dl_list * DL_ListRemove(struct dl_list * pDel) {
pDel->pNext->pPrev = pDel->pPrev;
pDel->pPrev->pNext = pDel->pNext;
/* point back to itself just to be safe, incase remove is called again */
@ -115,8 +115,8 @@ static INLINE PDL_LIST DL_ListRemove(PDL_LIST pDel) {
/*
* DL_ListRemoveItemFromHead - get a list item from the head
*/
static INLINE PDL_LIST DL_ListRemoveItemFromHead(PDL_LIST pList) {
PDL_LIST pItem = NULL;
static INLINE struct dl_list * DL_ListRemoveItemFromHead(struct dl_list * pList) {
struct dl_list * pItem = NULL;
if (pList->pNext != pList) {
pItem = pList->pNext;
/* remove the first item from head */
@ -125,8 +125,8 @@ static INLINE PDL_LIST DL_ListRemoveItemFromHead(PDL_LIST pList) {
return pItem;
}
static INLINE PDL_LIST DL_ListRemoveItemFromTail(PDL_LIST pList) {
PDL_LIST pItem = NULL;
static INLINE struct dl_list * DL_ListRemoveItemFromTail(struct dl_list * pList) {
struct dl_list * pItem = NULL;
if (pList->pPrev != pList) {
pItem = pList->pPrev;
/* remove the item from tail */
@ -136,7 +136,7 @@ static INLINE PDL_LIST DL_ListRemoveItemFromTail(PDL_LIST pList) {
}
/* transfer src list items to the tail of the destination list */
static INLINE void DL_ListTransferItemsToTail(PDL_LIST pDest, PDL_LIST pSrc) {
static INLINE void DL_ListTransferItemsToTail(struct dl_list * pDest, struct dl_list * pSrc) {
/* only concatenate if src is not empty */
if (!DL_LIST_IS_EMPTY(pSrc)) {
/* cut out circular list in src and re-attach to end of dest */

View File

@ -39,23 +39,23 @@ extern "C" {
#endif
/* Called to send a DataSet Open Reply back to the Target. */
A_STATUS wmi_dset_open_reply(struct wmi_t *wmip,
A_UINT32 status,
A_UINT32 access_cookie,
A_UINT32 size,
A_UINT32 version,
A_UINT32 targ_handle,
A_UINT32 targ_reply_fn,
A_UINT32 targ_reply_arg);
int wmi_dset_open_reply(struct wmi_t *wmip,
u32 status,
u32 access_cookie,
u32 size,
u32 version,
u32 targ_handle,
u32 targ_reply_fn,
u32 targ_reply_arg);
/* Called to send a DataSet Data Reply back to the Target. */
A_STATUS wmi_dset_data_reply(struct wmi_t *wmip,
A_UINT32 status,
A_UINT8 *host_buf,
A_UINT32 length,
A_UINT32 targ_buf,
A_UINT32 targ_reply_fn,
A_UINT32 targ_reply_arg);
int wmi_dset_data_reply(struct wmi_t *wmip,
u32 status,
u8 *host_buf,
u32 length,
u32 targ_buf,
u32 targ_reply_fn,
u32 targ_reply_arg);
#ifdef __cplusplus
}

View File

@ -28,32 +28,32 @@
/*
* Send a command to the Target in order to change output on GPIO pins.
*/
A_STATUS wmi_gpio_output_set(struct wmi_t *wmip,
A_UINT32 set_mask,
A_UINT32 clear_mask,
A_UINT32 enable_mask,
A_UINT32 disable_mask);
int wmi_gpio_output_set(struct wmi_t *wmip,
u32 set_mask,
u32 clear_mask,
u32 enable_mask,
u32 disable_mask);
/*
* Send a command to the Target requesting input state of GPIO pins.
*/
A_STATUS wmi_gpio_input_get(struct wmi_t *wmip);
int wmi_gpio_input_get(struct wmi_t *wmip);
/*
* Send a command to the Target to change the value of a GPIO register.
*/
A_STATUS wmi_gpio_register_set(struct wmi_t *wmip,
A_UINT32 gpioreg_id,
A_UINT32 value);
int wmi_gpio_register_set(struct wmi_t *wmip,
u32 gpioreg_id,
u32 value);
/*
* Send a command to the Target to fetch the value of a GPIO register.
*/
A_STATUS wmi_gpio_register_get(struct wmi_t *wmip, A_UINT32 gpioreg_id);
int wmi_gpio_register_get(struct wmi_t *wmip, u32 gpioreg_id);
/*
* Send a command to the Target, acknowledging some GPIO interrupts.
*/
A_STATUS wmi_gpio_intr_ack(struct wmi_t *wmip, A_UINT32 ack_mask);
int wmi_gpio_intr_ack(struct wmi_t *wmip, u32 ack_mask);
#endif /* _GPIO_API_H_ */

View File

@ -43,9 +43,9 @@ typedef HTC_ENDPOINT_ID HCI_TRANSPORT_PACKET_TYPE;
#define HCI_SET_PACKET_TYPE(pP,s) (pP)->Endpoint = (s)
/* callback when an HCI packet was completely sent */
typedef void (*HCI_TRANSPORT_SEND_PKT_COMPLETE)(void *, HTC_PACKET *);
typedef void (*HCI_TRANSPORT_SEND_PKT_COMPLETE)(void *, struct htc_packet *);
/* callback when an HCI packet is received */
typedef void (*HCI_TRANSPORT_RECV_PKT)(void *, HTC_PACKET *);
typedef void (*HCI_TRANSPORT_RECV_PKT)(void *, struct htc_packet *);
/* Optional receive buffer re-fill callback,
* On some OSes (like Linux) packets are allocated from a global pool and indicated up
* to the network stack. The driver never gets the packets back from the OS. For these OSes
@ -68,7 +68,7 @@ typedef void (*HCI_TRANSPORT_RECV_REFILL)(void *, HCI_TRANSPORT_PACKET_TYPE Ty
* NOTE*** This callback is mutually exclusive with the the refill callback above.
*
* */
typedef HTC_PACKET *(*HCI_TRANSPORT_RECV_ALLOC)(void *, HCI_TRANSPORT_PACKET_TYPE Type, int Length);
typedef struct htc_packet *(*HCI_TRANSPORT_RECV_ALLOC)(void *, HCI_TRANSPORT_PACKET_TYPE Type, int Length);
typedef enum _HCI_SEND_FULL_ACTION {
HCI_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */
@ -77,21 +77,21 @@ typedef enum _HCI_SEND_FULL_ACTION {
/* callback when an HCI send queue exceeds the caller's MaxSendQueueDepth threshold,
* the callback must return the send full action to take (either DROP or KEEP) */
typedef HCI_SEND_FULL_ACTION (*HCI_TRANSPORT_SEND_FULL)(void *, HTC_PACKET *);
typedef HCI_SEND_FULL_ACTION (*HCI_TRANSPORT_SEND_FULL)(void *, struct htc_packet *);
typedef struct {
struct hci_transport_properties {
int HeadRoom; /* number of bytes in front of HCI packet for header space */
int TailRoom; /* number of bytes at the end of the HCI packet for tail space */
int IOBlockPad; /* I/O block padding required (always a power of 2) */
} HCI_TRANSPORT_PROPERTIES;
};
typedef struct _HCI_TRANSPORT_CONFIG_INFO {
struct hci_transport_config_info {
int ACLRecvBufferWaterMark; /* low watermark to trigger recv refill */
int EventRecvBufferWaterMark; /* low watermark to trigger recv refill */
int MaxSendQueueDepth; /* max number of packets in the single send queue */
void *pContext; /* context for all callbacks */
void (*TransportFailure)(void *pContext, A_STATUS Status); /* transport failure callback */
A_STATUS (*TransportReady)(HCI_TRANSPORT_HANDLE, HCI_TRANSPORT_PROPERTIES *,void *pContext); /* transport is ready */
void (*TransportFailure)(void *pContext, int Status); /* transport failure callback */
int (*TransportReady)(HCI_TRANSPORT_HANDLE, struct hci_transport_properties *,void *pContext); /* transport is ready */
void (*TransportRemoved)(void *pContext); /* transport was removed */
/* packet processing callbacks */
HCI_TRANSPORT_SEND_PKT_COMPLETE pHCISendComplete;
@ -99,7 +99,7 @@ typedef struct _HCI_TRANSPORT_CONFIG_INFO {
HCI_TRANSPORT_RECV_REFILL pHCIPktRecvRefill;
HCI_TRANSPORT_RECV_ALLOC pHCIPktRecvAlloc;
HCI_TRANSPORT_SEND_FULL pHCISendFull;
} HCI_TRANSPORT_CONFIG_INFO;
};
/* ------ Function Prototypes ------ */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -113,7 +113,7 @@ typedef struct _HCI_TRANSPORT_CONFIG_INFO {
@example:
@see also: HCI_TransportDetach
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo);
HCI_TRANSPORT_HANDLE HCI_TransportAttach(void *HTCHandle, struct hci_transport_config_info *pInfo);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Detach from the HCI transport module
@ -134,14 +134,14 @@ void HCI_TransportDetach(HCI_TRANSPORT_HANDLE HciTrans);
@input: HciTrans - HCI transport handle
pQueue - a queue holding one or more packets
@output:
@return: A_OK on success
@return: 0 on success
@notes: user must supply HTC packets for capturing incomming HCI packets. The caller
must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL()
macro. Each packet in the queue must be of the same type and length
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue);
int HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet_queue *pQueue);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Send an HCI packet packet
@ -150,12 +150,12 @@ A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKE
pPacket - packet to send
Synchronous - send the packet synchronously (blocking)
@output:
@return: A_OK
@return: 0
@notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() and
HCI_SET_PACKET_TYPE() macros to prepare the packet.
If Synchronous is set to FALSE the call is fully asynchronous. On error or completion,
If Synchronous is set to false the call is fully asynchronous. On error or completion,
the registered send complete callback will be called.
If Synchronous is set to TRUE, the call will block until the packet is sent, if the
If Synchronous is set to true, the call will block until the packet is sent, if the
interface cannot send the packet within a 2 second timeout, the function will return
the failure code : A_EBUSY.
@ -166,7 +166,7 @@ A_STATUS HCI_TransportAddReceivePkts(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKE
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous);
int HCI_TransportSendPkt(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet *pPacket, bool Synchronous);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -187,13 +187,13 @@ void HCI_TransportStop(HCI_TRANSPORT_HANDLE HciTrans);
@function name: HCI_TransportStart
@input: HciTrans - hci transport handle
@output:
@return: A_OK on success
@return: 0 on success
@notes: HCI transport communication will begin, the caller can expect the arrival
of HCI recv packets as soon as this call returns.
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans);
int HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Enable or Disable Asynchronous Recv
@ -201,12 +201,12 @@ A_STATUS HCI_TransportStart(HCI_TRANSPORT_HANDLE HciTrans);
@input: HciTrans - hci transport handle
Enable - enable or disable asynchronous recv
@output:
@return: A_OK on success
@return: 0 on success
@notes: This API must be called when HCI recv is handled synchronously
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
int HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Receive an event packet from the HCI transport synchronously using polling
@ -215,15 +215,15 @@ A_STATUS HCI_TransportEnableDisableAsyncRecv(HCI_TRANSPORT_HANDLE HciTrans, A
pPacket - HTC packet to hold the recv data
MaxPollMS - maximum polling duration in Milliseconds;
@output:
@return: A_OK on success
@return: 0 on success
@notes: This API should be used only during HCI device initialization, the caller must call
HCI_TransportEnableDisableAsyncRecv with Enable=FALSE prior to using this API.
HCI_TransportEnableDisableAsyncRecv with Enable=false prior to using this API.
This API will only capture HCI Event packets.
@example:
@see also: HCI_TransportEnableDisableAsyncRecv
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
HTC_PACKET *pPacket,
int HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
struct htc_packet *pPacket,
int MaxPollMS);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -232,12 +232,12 @@ A_STATUS HCI_TransportRecvHCIEventSync(HCI_TRANSPORT_HANDLE HciTrans,
@input: HciTrans - hci transport handle
Baud - baud rate in bps
@output:
@return: A_OK on success
@return: 0 on success
@notes: This API should be used only after HCI device initialization
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud);
int HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, u32 Baud);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Enable/Disable HCI Transport Power Management
@ -245,12 +245,12 @@ A_STATUS HCI_TransportSetBaudRate(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Bau
@input: HciTrans - hci transport handle
Enable - 1 = Enable, 0 = Disable
@output:
@return: A_OK on success
@return: 0 on success
@notes:
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
int HCI_TransportEnablePowerMgmt(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
#ifdef __cplusplus
}

View File

@ -38,7 +38,7 @@ extern "C" {
typedef struct htc_callbacks HTC_CALLBACKS;
typedef struct hif_device HIF_DEVICE;
struct hif_device;
/*
* direction - Direction of transfer (HIF_READ/HIF_WRITE).
@ -153,7 +153,7 @@ typedef enum {
*
* HIF_DEVICE_GET_MBOX_ADDR
* input : none
* output : HIF_DEVICE_MBOX_INFO
* output : struct hif_device_mbox_info
* notes:
*
* HIF_DEVICE_GET_PENDING_EVENTS_FUNC
@ -190,7 +190,7 @@ typedef enum {
* HIF_DEVICE_GET_IRQ_YIELD_PARAMS
*
* input : none
* output : HIF_DEVICE_IRQ_YIELD_PARAMS
* output : struct hif_device_irq_yield_params
* note: This query checks if the HIF layer wishes to impose a processing yield count for the DSR handler.
* The DSR callback handler will exit after a fixed number of RX packets or events are processed.
* This query is only made if the device reports an IRQ processing mode of HIF_DEVICE_IRQ_SYNC_ONLY.
@ -203,7 +203,7 @@ typedef enum {
*
* HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT
* input : none
* output : HIF_DEVICE_SCATTER_SUPPORT_INFO
* output : struct hif_device_scatter_support_info
* note: This query checks if the HIF layer implements the SCATTER request interface. Scatter requests
* allows upper layers to submit mailbox I/O operations using a list of buffers. This is useful for
* multi-message transfers that can better utilize the bus interconnect.
@ -211,7 +211,7 @@ typedef enum {
*
* HIF_DEVICE_GET_OS_DEVICE
* intput : none
* output : HIF_DEVICE_OS_DEVICE_INFO;
* output : struct hif_device_os_device_info;
* note: On some operating systems, the HIF layer has a parent device object for the bus. This object
* may be required to register certain types of logical devices.
*
@ -223,10 +223,10 @@ typedef enum {
*
*/
typedef struct {
A_UINT32 ExtendedAddress; /* extended address for larger writes */
A_UINT32 ExtendedSize;
} HIF_MBOX_PROPERTIES;
struct hif_mbox_properties {
u32 ExtendedAddress; /* extended address for larger writes */
u32 ExtendedSize;
};
#define HIF_MBOX_FLAG_NO_BUNDLING (1 << 0) /* do not allow bundling over the mailbox */
@ -235,19 +235,19 @@ typedef enum _MBOX_BUF_IF_TYPE {
MBOX_BUS_IF_SPI = 1,
} MBOX_BUF_IF_TYPE;
typedef struct {
A_UINT32 MboxAddresses[4]; /* must be first element for legacy HIFs that return the address in
struct hif_device_mbox_info {
u32 MboxAddresses[4]; /* must be first element for legacy HIFs that return the address in
and ARRAY of 32-bit words */
/* the following describe extended mailbox properties */
HIF_MBOX_PROPERTIES MboxProp[4];
struct hif_mbox_properties MboxProp[4];
/* if the HIF supports the GMbox extended address region it can report it
* here, some interfaces cannot support the GMBOX address range and not set this */
A_UINT32 GMboxAddress;
A_UINT32 GMboxSize;
A_UINT32 Flags; /* flags to describe mbox behavior or usage */
u32 GMboxAddress;
u32 GMboxSize;
u32 Flags; /* flags to describe mbox behavior or usage */
MBOX_BUF_IF_TYPE MboxBusIFType; /* mailbox bus interface type */
} HIF_DEVICE_MBOX_INFO;
};
typedef enum {
HIF_DEVICE_IRQ_SYNC_ONLY, /* for HIF implementations that require the DSR to process all
@ -265,20 +265,19 @@ typedef enum {
*/
} HIF_DEVICE_POWER_CHANGE_TYPE;
typedef struct {
struct hif_device_irq_yield_params {
int RecvPacketYieldCount; /* max number of packets to force DSR to return */
} HIF_DEVICE_IRQ_YIELD_PARAMS;
};
typedef struct _HIF_SCATTER_ITEM {
A_UINT8 *pBuffer; /* CPU accessible address of buffer */
struct hif_scatter_item {
u8 *pBuffer; /* CPU accessible address of buffer */
int Length; /* length of transfer to/from this buffer */
void *pCallerContexts[2]; /* space for caller to insert a context associated with this item */
} HIF_SCATTER_ITEM;
};
struct _HIF_SCATTER_REQ;
typedef void ( *HIF_SCATTER_COMP_CB)(struct _HIF_SCATTER_REQ *);
struct hif_scatter_req;
typedef void ( *HIF_SCATTER_COMP_CB)(struct hif_scatter_req *);
typedef enum _HIF_SCATTER_METHOD {
HIF_SCATTER_NONE = 0,
@ -286,84 +285,84 @@ typedef enum _HIF_SCATTER_METHOD {
HIF_SCATTER_DMA_BOUNCE, /* Uses SG DMA but HIF layer uses an internal bounce buffer */
} HIF_SCATTER_METHOD;
typedef struct _HIF_SCATTER_REQ {
DL_LIST ListLink; /* link management */
A_UINT32 Address; /* address for the read/write operation */
A_UINT32 Request; /* request flags */
A_UINT32 TotalLength; /* total length of entire transfer */
A_UINT32 CallerFlags; /* caller specific flags can be stored here */
struct hif_scatter_req {
struct dl_list ListLink; /* link management */
u32 Address; /* address for the read/write operation */
u32 Request; /* request flags */
u32 TotalLength; /* total length of entire transfer */
u32 CallerFlags; /* caller specific flags can be stored here */
HIF_SCATTER_COMP_CB CompletionRoutine; /* completion routine set by caller */
A_STATUS CompletionStatus; /* status of completion */
int CompletionStatus; /* status of completion */
void *Context; /* caller context for this request */
int ValidScatterEntries; /* number of valid entries set by caller */
HIF_SCATTER_METHOD ScatterMethod; /* scatter method handled by HIF */
void *HIFPrivate[4]; /* HIF private area */
A_UINT8 *pScatterBounceBuffer; /* bounce buffer for upper layers to copy to/from */
HIF_SCATTER_ITEM ScatterList[1]; /* start of scatter list */
} HIF_SCATTER_REQ;
u8 *pScatterBounceBuffer; /* bounce buffer for upper layers to copy to/from */
struct hif_scatter_item ScatterList[1]; /* start of scatter list */
};
typedef HIF_SCATTER_REQ * ( *HIF_ALLOCATE_SCATTER_REQUEST)(HIF_DEVICE *device);
typedef void ( *HIF_FREE_SCATTER_REQUEST)(HIF_DEVICE *device, HIF_SCATTER_REQ *request);
typedef A_STATUS ( *HIF_READWRITE_SCATTER)(HIF_DEVICE *device, HIF_SCATTER_REQ *request);
typedef struct hif_scatter_req * ( *HIF_ALLOCATE_SCATTER_REQUEST)(struct hif_device *device);
typedef void ( *HIF_FREE_SCATTER_REQUEST)(struct hif_device *device, struct hif_scatter_req *request);
typedef int ( *HIF_READWRITE_SCATTER)(struct hif_device *device, struct hif_scatter_req *request);
typedef struct _HIF_DEVICE_SCATTER_SUPPORT_INFO {
struct hif_device_scatter_support_info {
/* information returned from HIF layer */
HIF_ALLOCATE_SCATTER_REQUEST pAllocateReqFunc;
HIF_FREE_SCATTER_REQUEST pFreeReqFunc;
HIF_READWRITE_SCATTER pReadWriteScatterFunc;
int MaxScatterEntries;
int MaxTransferSizePerScatterReq;
} HIF_DEVICE_SCATTER_SUPPORT_INFO;
};
typedef struct {
struct hif_device_os_device_info {
void *pOSDevice;
} HIF_DEVICE_OS_DEVICE_INFO;
};
#define HIF_MAX_DEVICES 1
struct htc_callbacks {
void *context; /* context to pass to the dsrhandler
note : rwCompletionHandler is provided the context passed to HIFReadWrite */
A_STATUS (* rwCompletionHandler)(void *rwContext, A_STATUS status);
A_STATUS (* dsrHandler)(void *context);
int (* rwCompletionHandler)(void *rwContext, int status);
int (* dsrHandler)(void *context);
};
typedef struct osdrv_callbacks {
void *context; /* context to pass for all callbacks except deviceRemovedHandler
the deviceRemovedHandler is only called if the device is claimed */
A_STATUS (* deviceInsertedHandler)(void *context, void *hif_handle);
A_STATUS (* deviceRemovedHandler)(void *claimedContext, void *hif_handle);
A_STATUS (* deviceSuspendHandler)(void *context);
A_STATUS (* deviceResumeHandler)(void *context);
A_STATUS (* deviceWakeupHandler)(void *context);
A_STATUS (* devicePowerChangeHandler)(void *context, HIF_DEVICE_POWER_CHANGE_TYPE config);
int (* deviceInsertedHandler)(void *context, void *hif_handle);
int (* deviceRemovedHandler)(void *claimedContext, void *hif_handle);
int (* deviceSuspendHandler)(void *context);
int (* deviceResumeHandler)(void *context);
int (* deviceWakeupHandler)(void *context);
int (* devicePowerChangeHandler)(void *context, HIF_DEVICE_POWER_CHANGE_TYPE config);
} OSDRV_CALLBACKS;
#define HIF_OTHER_EVENTS (1 << 0) /* other interrupts (non-Recv) are pending, host
needs to read the register table to figure out what */
#define HIF_RECV_MSG_AVAIL (1 << 1) /* pending recv packet */
typedef struct _HIF_PENDING_EVENTS_INFO {
A_UINT32 Events;
A_UINT32 LookAhead;
A_UINT32 AvailableRecvBytes;
struct hif_pending_events_info {
u32 Events;
u32 LookAhead;
u32 AvailableRecvBytes;
#ifdef THREAD_X
A_UINT32 Polling;
A_UINT32 INT_CAUSE_REG;
u32 Polling;
u32 INT_CAUSE_REG;
#endif
} HIF_PENDING_EVENTS_INFO;
};
/* function to get pending events , some HIF modules use special mechanisms
* to detect packet available and other interrupts */
typedef A_STATUS ( *HIF_PENDING_EVENTS_FUNC)(HIF_DEVICE *device,
HIF_PENDING_EVENTS_INFO *pEvents,
typedef int ( *HIF_PENDING_EVENTS_FUNC)(struct hif_device *device,
struct hif_pending_events_info *pEvents,
void *AsyncContext);
#define HIF_MASK_RECV TRUE
#define HIF_UNMASK_RECV FALSE
#define HIF_MASK_RECV true
#define HIF_UNMASK_RECV false
/* function to mask recv events */
typedef A_STATUS ( *HIF_MASK_UNMASK_RECV_EVENT)(HIF_DEVICE *device,
A_BOOL Mask,
typedef int ( *HIF_MASK_UNMASK_RECV_EVENT)(struct hif_device *device,
bool Mask,
void *AsyncContext);
@ -372,19 +371,19 @@ typedef A_STATUS ( *HIF_MASK_UNMASK_RECV_EVENT)(HIF_DEVICE *device,
* and to set OS driver callbacks (i.e. insertion/removal) to the HIF layer
*
*/
A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks);
int HIFInit(OSDRV_CALLBACKS *callbacks);
/* This API claims the HIF device and provides a context for handling removal.
* The device removal callback is only called when the OSDRV layer claims
* a device. The claimed context must be non-NULL */
void HIFClaimDevice(HIF_DEVICE *device, void *claimedContext);
void HIFClaimDevice(struct hif_device *device, void *claimedContext);
/* release the claimed device */
void HIFReleaseDevice(HIF_DEVICE *device);
void HIFReleaseDevice(struct hif_device *device);
/* This API allows the HTC layer to attach to the HIF device */
A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks);
int HIFAttachHTC(struct hif_device *device, HTC_CALLBACKS *callbacks);
/* This API detaches the HTC layer from the HIF device */
void HIFDetachHTC(HIF_DEVICE *device);
void HIFDetachHTC(struct hif_device *device);
/*
* This API is used to provide the read/write interface over the specific bus
@ -398,19 +397,19 @@ void HIFDetachHTC(HIF_DEVICE *device);
* length - Amount of data to be transmitted or received.
* request - Characterizes the attributes of the command.
*/
A_STATUS
HIFReadWrite(HIF_DEVICE *device,
A_UINT32 address,
A_UCHAR *buffer,
A_UINT32 length,
A_UINT32 request,
int
HIFReadWrite(struct hif_device *device,
u32 address,
u8 *buffer,
u32 length,
u32 request,
void *context);
/*
* This can be initiated from the unload driver context when the OSDRV layer has no more use for
* the device.
*/
void HIFShutDownDevice(HIF_DEVICE *device);
void HIFShutDownDevice(struct hif_device *device);
/*
* This should translate to an acknowledgment to the bus driver indicating that
@ -419,11 +418,11 @@ void HIFShutDownDevice(HIF_DEVICE *device);
* This should prevent the bus driver from raising an interrupt unless the
* previous one has been serviced and acknowledged using the previous API.
*/
void HIFAckInterrupt(HIF_DEVICE *device);
void HIFAckInterrupt(struct hif_device *device);
void HIFMaskInterrupt(HIF_DEVICE *device);
void HIFMaskInterrupt(struct hif_device *device);
void HIFUnMaskInterrupt(HIF_DEVICE *device);
void HIFUnMaskInterrupt(struct hif_device *device);
#ifdef THREAD_X
/*
@ -441,15 +440,15 @@ int HIFIRQEventNotify(void);
int HIFRWCompleteEventNotify(void);
#endif
A_STATUS
HIFConfigureDevice(HIF_DEVICE *device, HIF_DEVICE_CONFIG_OPCODE opcode,
void *config, A_UINT32 configLen);
int
HIFConfigureDevice(struct hif_device *device, HIF_DEVICE_CONFIG_OPCODE opcode,
void *config, u32 configLen);
/*
* This API wait for the remaining MBOX messages to be drained
* This should be moved to HTC AR6K layer
*/
A_STATUS hifWaitForPendingRecv(HIF_DEVICE *device);
int hifWaitForPendingRecv(struct hif_device *device);
#ifdef __cplusplus
}

View File

@ -41,31 +41,31 @@ extern "C" {
typedef void *HTC_HANDLE;
typedef A_UINT16 HTC_SERVICE_ID;
typedef u16 HTC_SERVICE_ID;
typedef struct _HTC_INIT_INFO {
struct htc_init_info {
void *pContext; /* context for target failure notification */
void (*TargetFailure)(void *Instance, A_STATUS Status);
} HTC_INIT_INFO;
void (*TargetFailure)(void *Instance, int Status);
};
/* per service connection send completion */
typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *,HTC_PACKET *);
typedef void (*HTC_EP_SEND_PKT_COMPLETE)(void *,struct htc_packet *);
/* per service connection callback when a plurality of packets have been sent
* The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
* The struct htc_packet_queue is a temporary queue object (e.g. freed on return from the callback)
* to hold a list of completed send packets.
* If the handler cannot fully traverse the packet queue before returning, it should
* transfer the items of the queue into the caller's private queue using:
* HTC_PACKET_ENQUEUE() */
typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,HTC_PACKET_QUEUE *);
typedef void (*HTC_EP_SEND_PKT_COMP_MULTIPLE)(void *,struct htc_packet_queue *);
/* per service connection pkt received */
typedef void (*HTC_EP_RECV_PKT)(void *,HTC_PACKET *);
typedef void (*HTC_EP_RECV_PKT)(void *,struct htc_packet *);
/* per service connection callback when a plurality of packets are received
* The HTC_PACKET_QUEUE is a temporary queue object (e.g. freed on return from the callback)
* The struct htc_packet_queue is a temporary queue object (e.g. freed on return from the callback)
* to hold a list of recv packets.
* If the handler cannot fully traverse the packet queue before returning, it should
* transfer the items of the queue into the caller's private queue using:
* HTC_PACKET_ENQUEUE() */
typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *,HTC_PACKET_QUEUE *);
typedef void (*HTC_EP_RECV_PKT_MULTIPLE)(void *,struct htc_packet_queue *);
/* Optional per service connection receive buffer re-fill callback,
* On some OSes (like Linux) packets are allocated from a global pool and indicated up
@ -94,7 +94,7 @@ typedef void (*HTC_EP_RECV_REFILL)(void *, HTC_ENDPOINT_ID Endpoint);
* amount of "committed" memory used to receive packets.
*
* */
typedef HTC_PACKET *(*HTC_EP_RECV_ALLOC)(void *, HTC_ENDPOINT_ID Endpoint, int Length);
typedef struct htc_packet *(*HTC_EP_RECV_ALLOC)(void *, HTC_ENDPOINT_ID Endpoint, int Length);
typedef enum _HTC_SEND_FULL_ACTION {
HTC_SEND_FULL_KEEP = 0, /* packet that overflowed should be kept in the queue */
@ -114,9 +114,9 @@ typedef enum _HTC_SEND_FULL_ACTION {
* closed loop mechanism will prevent the network stack from overunning the NIC
* The packet to keep or drop is passed for inspection to the registered handler the handler
* must ONLY inspect the packet, it may not free or reclaim the packet. */
typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *, HTC_PACKET *pPacket);
typedef HTC_SEND_FULL_ACTION (*HTC_EP_SEND_QUEUE_FULL)(void *, struct htc_packet *pPacket);
typedef struct _HTC_EP_CALLBACKS {
struct htc_ep_callbacks {
void *pContext; /* context for each callback */
HTC_EP_SEND_PKT_COMPLETE EpTxComplete; /* tx completion callback for connected endpoint */
HTC_EP_RECV_PKT EpRecv; /* receive callback for connected endpoint */
@ -136,39 +136,39 @@ typedef struct _HTC_EP_CALLBACKS {
when the recv queue drops below this value
if set to 0, the refill is only called when packets
are empty */
} HTC_EP_CALLBACKS;
};
/* service connection information */
typedef struct _HTC_SERVICE_CONNECT_REQ {
struct htc_service_connect_req {
HTC_SERVICE_ID ServiceID; /* service ID to connect to */
A_UINT16 ConnectionFlags; /* connection flags, see htc protocol definition */
A_UINT8 *pMetaData; /* ptr to optional service-specific meta-data */
A_UINT8 MetaDataLength; /* optional meta data length */
HTC_EP_CALLBACKS EpCallbacks; /* endpoint callbacks */
u16 ConnectionFlags; /* connection flags, see htc protocol definition */
u8 *pMetaData; /* ptr to optional service-specific meta-data */
u8 MetaDataLength; /* optional meta data length */
struct htc_ep_callbacks EpCallbacks; /* endpoint callbacks */
int MaxSendQueueDepth; /* maximum depth of any send queue */
A_UINT32 LocalConnectionFlags; /* HTC flags for the host-side (local) connection */
u32 LocalConnectionFlags; /* HTC flags for the host-side (local) connection */
unsigned int MaxSendMsgSize; /* override max message size in send direction */
} HTC_SERVICE_CONNECT_REQ;
};
#define HTC_LOCAL_CONN_FLAGS_ENABLE_SEND_BUNDLE_PADDING (1 << 0) /* enable send bundle padding for this endpoint */
/* service connection response information */
typedef struct _HTC_SERVICE_CONNECT_RESP {
A_UINT8 *pMetaData; /* caller supplied buffer to optional meta-data */
A_UINT8 BufferLength; /* length of caller supplied buffer */
A_UINT8 ActualLength; /* actual length of meta data */
struct htc_service_connect_resp {
u8 *pMetaData; /* caller supplied buffer to optional meta-data */
u8 BufferLength; /* length of caller supplied buffer */
u8 ActualLength; /* actual length of meta data */
HTC_ENDPOINT_ID Endpoint; /* endpoint to communicate over */
unsigned int MaxMsgLength; /* max length of all messages over this endpoint */
A_UINT8 ConnectRespCode; /* connect response code from target */
} HTC_SERVICE_CONNECT_RESP;
u8 ConnectRespCode; /* connect response code from target */
};
/* endpoint distribution structure */
typedef struct _HTC_ENDPOINT_CREDIT_DIST {
struct _HTC_ENDPOINT_CREDIT_DIST *pNext;
struct _HTC_ENDPOINT_CREDIT_DIST *pPrev;
struct htc_endpoint_credit_dist {
struct htc_endpoint_credit_dist *pNext;
struct htc_endpoint_credit_dist *pPrev;
HTC_SERVICE_ID ServiceID; /* Service ID (set by HTC) */
HTC_ENDPOINT_ID Endpoint; /* endpoint for this distribution struct (set by HTC) */
A_UINT32 DistFlags; /* distribution flags, distribution function can
u32 DistFlags; /* distribution flags, distribution function can
set default activity using SET_EP_ACTIVE() macro */
int TxCreditsNorm; /* credits for normal operation, anything above this
indicates the endpoint is over-subscribed, this field
@ -195,9 +195,9 @@ typedef struct _HTC_ENDPOINT_CREDIT_DIST {
or HTC_CREDIT_DIST_SEND_COMPLETE is indicated on an endpoint
that has non-zero credits to recover
*/
} HTC_ENDPOINT_CREDIT_DIST;
};
#define HTC_EP_ACTIVE ((A_UINT32) (1u << 31))
#define HTC_EP_ACTIVE ((u32) (1u << 31))
/* macro to check if an endpoint has gone active, useful for credit
* distributions */
@ -216,11 +216,11 @@ typedef enum _HTC_CREDIT_DIST_REASON {
} HTC_CREDIT_DIST_REASON;
typedef void (*HTC_CREDIT_DIST_CALLBACK)(void *Context,
HTC_ENDPOINT_CREDIT_DIST *pEPList,
struct htc_endpoint_credit_dist *pEPList,
HTC_CREDIT_DIST_REASON Reason);
typedef void (*HTC_CREDIT_INIT_CALLBACK)(void *Context,
HTC_ENDPOINT_CREDIT_DIST *pEPList,
struct htc_endpoint_credit_dist *pEPList,
int TotalCredits);
/* endpoint statistics action */
@ -231,31 +231,31 @@ typedef enum _HTC_ENDPOINT_STAT_ACTION {
} HTC_ENDPOINT_STAT_ACTION;
/* endpoint statistics */
typedef struct _HTC_ENDPOINT_STATS {
A_UINT32 TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on
struct htc_endpoint_stats {
u32 TxCreditLowIndications; /* number of times the host set the credit-low flag in a send message on
this endpoint */
A_UINT32 TxIssued; /* running count of total TX packets issued */
A_UINT32 TxPacketsBundled; /* running count of TX packets that were issued in bundles */
A_UINT32 TxBundles; /* running count of TX bundles that were issued */
A_UINT32 TxDropped; /* tx packets that were dropped */
A_UINT32 TxCreditRpts; /* running count of total credit reports received for this endpoint */
A_UINT32 TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */
A_UINT32 TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */
A_UINT32 TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */
A_UINT32 TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */
A_UINT32 TxCreditsFromOther; /* count of credits received via another endpoint */
A_UINT32 TxCreditsFromEp0; /* count of credits received via another endpoint */
A_UINT32 TxCreditsConsummed; /* count of consummed credits */
A_UINT32 TxCreditsReturned; /* count of credits returned */
A_UINT32 RxReceived; /* count of RX packets received */
A_UINT32 RxLookAheads; /* count of lookahead records
u32 TxIssued; /* running count of total TX packets issued */
u32 TxPacketsBundled; /* running count of TX packets that were issued in bundles */
u32 TxBundles; /* running count of TX bundles that were issued */
u32 TxDropped; /* tx packets that were dropped */
u32 TxCreditRpts; /* running count of total credit reports received for this endpoint */
u32 TxCreditRptsFromRx; /* credit reports received from this endpoint's RX packets */
u32 TxCreditRptsFromOther; /* credit reports received from RX packets of other endpoints */
u32 TxCreditRptsFromEp0; /* credit reports received from endpoint 0 RX packets */
u32 TxCreditsFromRx; /* count of credits received via Rx packets on this endpoint */
u32 TxCreditsFromOther; /* count of credits received via another endpoint */
u32 TxCreditsFromEp0; /* count of credits received via another endpoint */
u32 TxCreditsConsummed; /* count of consummed credits */
u32 TxCreditsReturned; /* count of credits returned */
u32 RxReceived; /* count of RX packets received */
u32 RxLookAheads; /* count of lookahead records
found in messages received on this endpoint */
A_UINT32 RxPacketsBundled; /* count of recv packets received in a bundle */
A_UINT32 RxBundleLookAheads; /* count of number of bundled lookaheads */
A_UINT32 RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */
A_UINT32 RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */
A_UINT32 RxAllocThreshBytes; /* total number of bytes */
} HTC_ENDPOINT_STATS;
u32 RxPacketsBundled; /* count of recv packets received in a bundle */
u32 RxBundleLookAheads; /* count of number of bundled lookaheads */
u32 RxBundleIndFromHdr; /* count of the number of bundle indications from the HTC header */
u32 RxAllocThreshHit; /* count of the number of times the recv allocation threshhold was hit */
u32 RxAllocThreshBytes; /* total number of bytes */
};
/* ------ Function Prototypes ------ */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@ -269,7 +269,7 @@ typedef struct _HTC_ENDPOINT_STATS {
@example:
@see also: HTCDestroy
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
HTC_HANDLE HTCCreate(void *HifDevice, HTC_INIT_INFO *pInfo);
HTC_HANDLE HTCCreate(void *HifDevice, struct htc_init_info *pInfo);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Get the underlying HIF device handle
@function name: HTCGetHifDevice
@ -319,7 +319,7 @@ void HTCSetCreditDistribution(HTC_HANDLE HTCHandle,
@example:
@see also: HTCConnectService
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle);
int HTCWaitTarget(HTC_HANDLE HTCHandle);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Start target service communications
@function name: HTCStart
@ -334,21 +334,21 @@ A_STATUS HTCWaitTarget(HTC_HANDLE HTCHandle);
@example:
@see also: HTCConnectService
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCStart(HTC_HANDLE HTCHandle);
int HTCStart(HTC_HANDLE HTCHandle);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Add receive packet to HTC
@function name: HTCAddReceivePkt
@input: HTCHandle - HTC handle
pPacket - HTC receive packet to add
@output:
@return: A_OK on success
@return: 0 on success
@notes: user must supply HTC packets for capturing incomming HTC frames. The caller
must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL()
macro.
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCAddReceivePkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
int HTCAddReceivePkt(HTC_HANDLE HTCHandle, struct htc_packet *pPacket);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Connect to an HTC service
@function name: HTCConnectService
@ -361,23 +361,23 @@ A_STATUS HTCAddReceivePkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
@example:
@see also: HTCStart
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCConnectService(HTC_HANDLE HTCHandle,
HTC_SERVICE_CONNECT_REQ *pReq,
HTC_SERVICE_CONNECT_RESP *pResp);
int HTCConnectService(HTC_HANDLE HTCHandle,
struct htc_service_connect_req *pReq,
struct htc_service_connect_resp *pResp);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Send an HTC packet
@function name: HTCSendPkt
@input: HTCHandle - HTC handle
pPacket - packet to send
@output:
@return: A_OK
@return: 0
@notes: Caller must initialize packet using SET_HTC_PACKET_INFO_TX() macro.
This interface is fully asynchronous. On error, HTC SendPkt will
call the registered Endpoint callback to cleanup the packet.
@example:
@see also: HTCFlushEndpoint
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCSendPkt(HTC_HANDLE HTCHandle, HTC_PACKET *pPacket);
int HTCSendPkt(HTC_HANDLE HTCHandle, struct htc_packet *pPacket);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Stop HTC service communications
@function name: HTCStop
@ -431,7 +431,7 @@ void HTCDumpCreditStates(HTC_HANDLE HTCHandle);
@function name: HTCIndicateActivityChange
@input: HTCHandle - HTC handle
Endpoint - endpoint in which activity has changed
Active - TRUE if active, FALSE if it has become inactive
Active - true if active, false if it has become inactive
@output:
@return:
@notes: This triggers the registered credit distribution function to
@ -441,7 +441,7 @@ void HTCDumpCreditStates(HTC_HANDLE HTCHandle);
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
A_BOOL Active);
bool Active);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Get endpoint statistics
@ -452,9 +452,9 @@ void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
@output:
pStats - statistics that were sampled (can be NULL if Action is HTC_EP_STAT_CLEAR)
@return: TRUE if statistics profiling is enabled, otherwise FALSE.
@return: true if statistics profiling is enabled, otherwise false.
@notes: Statistics is a compile-time option and this function may return FALSE
@notes: Statistics is a compile-time option and this function may return false
if HTC is not compiled with profiling.
The caller can specify the statistic "action" to take when sampling
@ -469,10 +469,10 @@ void HTCIndicateActivityChange(HTC_HANDLE HTCHandle,
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_BOOL HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
bool HTCGetEndpointStatistics(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint,
HTC_ENDPOINT_STAT_ACTION Action,
HTC_ENDPOINT_STATS *pStats);
struct htc_endpoint_stats *pStats);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Unblock HTC message reception
@ -499,10 +499,10 @@ void HTCUnblockRecv(HTC_HANDLE HTCHandle);
@input: HTCHandle - HTC handle
pPktQueue - local queue holding packets to send
@output:
@return: A_OK
@return: 0
@notes: Caller must initialize each packet using SET_HTC_PACKET_INFO_TX() macro.
The queue must only contain packets directed at the same endpoint.
Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the TX packets in FIFO order.
Caller supplies a pointer to an struct htc_packet_queue structure holding the TX packets in FIFO order.
This API will remove the packets from the pkt queue and place them into the HTC Tx Queue
and bundle messages where possible.
The caller may allocate the pkt queue on the stack to hold the packets.
@ -511,7 +511,7 @@ void HTCUnblockRecv(HTC_HANDLE HTCHandle);
@example:
@see also: HTCFlushEndpoint
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue);
int HTCSendPktsMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Add multiple receive packets to HTC
@ -519,18 +519,18 @@ A_STATUS HTCSendPktsMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueu
@input: HTCHandle - HTC handle
pPktQueue - HTC receive packet queue holding packets to add
@output:
@return: A_OK on success
@return: 0 on success
@notes: user must supply HTC packets for capturing incomming HTC frames. The caller
must initialize each HTC packet using the SET_HTC_PACKET_INFO_RX_REFILL()
macro. The queue must only contain recv packets for the same endpoint.
Caller supplies a pointer to an HTC_PACKET_QUEUE structure holding the recv packet.
Caller supplies a pointer to an struct htc_packet_queue structure holding the recv packet.
This API will remove the packets from the pkt queue and place them into internal
recv packet list.
The caller may allocate the pkt queue on the stack to hold the packets.
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPktQueue);
int HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, struct htc_packet_queue *pPktQueue);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@desc: Check if an endpoint is marked active
@ -538,12 +538,12 @@ A_STATUS HTCAddReceivePktMultiple(HTC_HANDLE HTCHandle, HTC_PACKET_QUEUE *pPk
@input: HTCHandle - HTC handle
Endpoint - endpoint to check for active state
@output:
@return: returns TRUE if Endpoint is Active
@return: returns true if Endpoint is Active
@notes:
@example:
@see also:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
A_BOOL HTCIsEndpointActive(HTC_HANDLE HTCHandle,
bool HTCIsEndpointActive(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint);
@ -564,9 +564,9 @@ int HTCGetNumRecvBuffers(HTC_HANDLE HTCHandle,
/* internally used functions for testing... */
void HTCEnableRecv(HTC_HANDLE HTCHandle);
void HTCDisableRecv(HTC_HANDLE HTCHandle);
A_STATUS HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
A_UINT32 TimeoutInMs,
A_BOOL *pbIsRecvPending);
int HTCWaitForPendingRecv(HTC_HANDLE HTCHandle,
u32 TimeoutInMs,
bool *pbIsRecvPending);
#ifdef __cplusplus
}

View File

@ -42,37 +42,37 @@ typedef enum
ENDPOINT_MAX,
} HTC_ENDPOINT_ID;
struct _HTC_PACKET;
struct htc_packet;
typedef void (* HTC_PACKET_COMPLETION)(void *,struct _HTC_PACKET *);
typedef void (* HTC_PACKET_COMPLETION)(void *,struct htc_packet *);
typedef A_UINT16 HTC_TX_TAG;
typedef u16 HTC_TX_TAG;
typedef struct _HTC_TX_PACKET_INFO {
struct htc_tx_packet_info {
HTC_TX_TAG Tag; /* tag used to selective flush packets */
int CreditsUsed; /* number of credits used for this TX packet (HTC internal) */
A_UINT8 SendFlags; /* send flags (HTC internal) */
u8 SendFlags; /* send flags (HTC internal) */
int SeqNo; /* internal seq no for debugging (HTC internal) */
} HTC_TX_PACKET_INFO;
};
#define HTC_TX_PACKET_TAG_ALL 0 /* a tag of zero is reserved and used to flush ALL packets */
#define HTC_TX_PACKET_TAG_INTERNAL 1 /* internal tags start here */
#define HTC_TX_PACKET_TAG_USER_DEFINED (HTC_TX_PACKET_TAG_INTERNAL + 9) /* user-defined tags start here */
typedef struct _HTC_RX_PACKET_INFO {
A_UINT32 ExpectedHdr; /* HTC internal use */
A_UINT32 HTCRxFlags; /* HTC internal use */
A_UINT32 IndicationFlags; /* indication flags set on each RX packet indication */
} HTC_RX_PACKET_INFO;
struct htc_rx_packet_info {
u32 ExpectedHdr; /* HTC internal use */
u32 HTCRxFlags; /* HTC internal use */
u32 IndicationFlags; /* indication flags set on each RX packet indication */
};
#define HTC_RX_FLAGS_INDICATE_MORE_PKTS (1 << 0) /* more packets on this endpoint are being fetched */
/* wrapper around endpoint-specific packets */
typedef struct _HTC_PACKET {
DL_LIST ListLink; /* double link */
struct htc_packet {
struct dl_list ListLink; /* double link */
void *pPktContext; /* caller's per packet specific context */
A_UINT8 *pBufferStart; /* the true buffer start , the caller can
u8 *pBufferStart; /* the true buffer start , the caller can
store the real buffer start here. In
receive callbacks, the HTC layer sets pBuffer
to the start of the payload past the header. This
@ -85,20 +85,20 @@ typedef struct _HTC_PACKET {
* points to the start of the HTC header but when returned
* to the caller points to the start of the payload
*/
A_UINT8 *pBuffer; /* payload start (RX/TX) */
A_UINT32 BufferLength; /* length of buffer */
A_UINT32 ActualLength; /* actual length of payload */
u8 *pBuffer; /* payload start (RX/TX) */
u32 BufferLength; /* length of buffer */
u32 ActualLength; /* actual length of payload */
HTC_ENDPOINT_ID Endpoint; /* endpoint that this packet was sent/recv'd from */
A_STATUS Status; /* completion status */
int Status; /* completion status */
union {
HTC_TX_PACKET_INFO AsTx; /* Tx Packet specific info */
HTC_RX_PACKET_INFO AsRx; /* Rx Packet specific info */
struct htc_tx_packet_info AsTx; /* Tx Packet specific info */
struct htc_rx_packet_info AsRx; /* Rx Packet specific info */
} PktInfo;
/* the following fields are for internal HTC use */
HTC_PACKET_COMPLETION Completion; /* completion */
void *pContext; /* HTC private completion context */
} HTC_PACKET;
};
@ -139,10 +139,10 @@ typedef struct _HTC_PACKET {
}
/* HTC Packet Queueing Macros */
typedef struct _HTC_PACKET_QUEUE {
DL_LIST QueueHead;
struct htc_packet_queue {
struct dl_list QueueHead;
int Depth;
} HTC_PACKET_QUEUE;
};
/* initialize queue */
#define INIT_HTC_PACKET_QUEUE(pQ) \
@ -165,11 +165,11 @@ typedef struct _HTC_PACKET_QUEUE {
/* test if a queue is empty */
#define HTC_QUEUE_EMPTY(pQ) ((pQ)->Depth == 0)
/* get packet at head without removing it */
static INLINE HTC_PACKET *HTC_GET_PKT_AT_HEAD(HTC_PACKET_QUEUE *queue) {
static INLINE struct htc_packet *HTC_GET_PKT_AT_HEAD(struct htc_packet_queue *queue) {
if (queue->Depth == 0) {
return NULL;
}
return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),HTC_PACKET,ListLink);
return A_CONTAINING_STRUCT((DL_LIST_GET_ITEM_AT_HEAD(&queue->QueueHead)),struct htc_packet,ListLink);
}
/* remove a packet from a queue, where-ever it is in the queue */
#define HTC_PACKET_REMOVE(pQ,p) \
@ -179,21 +179,21 @@ static INLINE HTC_PACKET *HTC_GET_PKT_AT_HEAD(HTC_PACKET_QUEUE *queue) {
}
/* dequeue an HTC packet from the head of the queue */
static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE(HTC_PACKET_QUEUE *queue) {
DL_LIST *pItem = DL_ListRemoveItemFromHead(&queue->QueueHead);
static INLINE struct htc_packet *HTC_PACKET_DEQUEUE(struct htc_packet_queue *queue) {
struct dl_list *pItem = DL_ListRemoveItemFromHead(&queue->QueueHead);
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
return A_CONTAINING_STRUCT(pItem, struct htc_packet, ListLink);
}
return NULL;
}
/* dequeue an HTC packet from the tail of the queue */
static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE_TAIL(HTC_PACKET_QUEUE *queue) {
DL_LIST *pItem = DL_ListRemoveItemFromTail(&queue->QueueHead);
static INLINE struct htc_packet *HTC_PACKET_DEQUEUE_TAIL(struct htc_packet_queue *queue) {
struct dl_list *pItem = DL_ListRemoveItemFromTail(&queue->QueueHead);
if (pItem != NULL) {
queue->Depth--;
return A_CONTAINING_STRUCT(pItem, HTC_PACKET, ListLink);
return A_CONTAINING_STRUCT(pItem, struct htc_packet, ListLink);
}
return NULL;
}
@ -220,7 +220,7 @@ static INLINE HTC_PACKET *HTC_PACKET_DEQUEUE_TAIL(HTC_PACKET_QUEUE *queue) {
}
#define HTC_PACKET_QUEUE_ITERATE_ALLOW_REMOVE(pQ, pPTemp) \
ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead,(pPTemp), HTC_PACKET, ListLink)
ITERATE_OVER_LIST_ALLOW_REMOVE(&(pQ)->QueueHead,(pPTemp), struct htc_packet, ListLink)
#define HTC_PACKET_QUEUE_ITERATE_END ITERATE_END

View File

@ -30,48 +30,48 @@
/*** WARNING : Add to the end of the TABLE! do not change the order ****/
typedef struct targetdef_s {
A_UINT32 d_RTC_BASE_ADDRESS;
A_UINT32 d_SYSTEM_SLEEP_OFFSET;
A_UINT32 d_SYSTEM_SLEEP_DISABLE_LSB;
A_UINT32 d_SYSTEM_SLEEP_DISABLE_MASK;
A_UINT32 d_CLOCK_CONTROL_OFFSET;
A_UINT32 d_CLOCK_CONTROL_SI0_CLK_MASK;
A_UINT32 d_RESET_CONTROL_OFFSET;
A_UINT32 d_RESET_CONTROL_SI0_RST_MASK;
A_UINT32 d_GPIO_BASE_ADDRESS;
A_UINT32 d_GPIO_PIN0_OFFSET;
A_UINT32 d_GPIO_PIN1_OFFSET;
A_UINT32 d_GPIO_PIN0_CONFIG_MASK;
A_UINT32 d_GPIO_PIN1_CONFIG_MASK;
A_UINT32 d_SI_CONFIG_BIDIR_OD_DATA_LSB;
A_UINT32 d_SI_CONFIG_BIDIR_OD_DATA_MASK;
A_UINT32 d_SI_CONFIG_I2C_LSB;
A_UINT32 d_SI_CONFIG_I2C_MASK;
A_UINT32 d_SI_CONFIG_POS_SAMPLE_LSB;
A_UINT32 d_SI_CONFIG_POS_SAMPLE_MASK;
A_UINT32 d_SI_CONFIG_INACTIVE_CLK_LSB;
A_UINT32 d_SI_CONFIG_INACTIVE_CLK_MASK;
A_UINT32 d_SI_CONFIG_INACTIVE_DATA_LSB;
A_UINT32 d_SI_CONFIG_INACTIVE_DATA_MASK;
A_UINT32 d_SI_CONFIG_DIVIDER_LSB;
A_UINT32 d_SI_CONFIG_DIVIDER_MASK;
A_UINT32 d_SI_BASE_ADDRESS;
A_UINT32 d_SI_CONFIG_OFFSET;
A_UINT32 d_SI_TX_DATA0_OFFSET;
A_UINT32 d_SI_TX_DATA1_OFFSET;
A_UINT32 d_SI_RX_DATA0_OFFSET;
A_UINT32 d_SI_RX_DATA1_OFFSET;
A_UINT32 d_SI_CS_OFFSET;
A_UINT32 d_SI_CS_DONE_ERR_MASK;
A_UINT32 d_SI_CS_DONE_INT_MASK;
A_UINT32 d_SI_CS_START_LSB;
A_UINT32 d_SI_CS_START_MASK;
A_UINT32 d_SI_CS_RX_CNT_LSB;
A_UINT32 d_SI_CS_RX_CNT_MASK;
A_UINT32 d_SI_CS_TX_CNT_LSB;
A_UINT32 d_SI_CS_TX_CNT_MASK;
A_UINT32 d_BOARD_DATA_SZ;
A_UINT32 d_BOARD_EXT_DATA_SZ;
u32 d_RTC_BASE_ADDRESS;
u32 d_SYSTEM_SLEEP_OFFSET;
u32 d_SYSTEM_SLEEP_DISABLE_LSB;
u32 d_SYSTEM_SLEEP_DISABLE_MASK;
u32 d_CLOCK_CONTROL_OFFSET;
u32 d_CLOCK_CONTROL_SI0_CLK_MASK;
u32 d_RESET_CONTROL_OFFSET;
u32 d_RESET_CONTROL_SI0_RST_MASK;
u32 d_GPIO_BASE_ADDRESS;
u32 d_GPIO_PIN0_OFFSET;
u32 d_GPIO_PIN1_OFFSET;
u32 d_GPIO_PIN0_CONFIG_MASK;
u32 d_GPIO_PIN1_CONFIG_MASK;
u32 d_SI_CONFIG_BIDIR_OD_DATA_LSB;
u32 d_SI_CONFIG_BIDIR_OD_DATA_MASK;
u32 d_SI_CONFIG_I2C_LSB;
u32 d_SI_CONFIG_I2C_MASK;
u32 d_SI_CONFIG_POS_SAMPLE_LSB;
u32 d_SI_CONFIG_POS_SAMPLE_MASK;
u32 d_SI_CONFIG_INACTIVE_CLK_LSB;
u32 d_SI_CONFIG_INACTIVE_CLK_MASK;
u32 d_SI_CONFIG_INACTIVE_DATA_LSB;
u32 d_SI_CONFIG_INACTIVE_DATA_MASK;
u32 d_SI_CONFIG_DIVIDER_LSB;
u32 d_SI_CONFIG_DIVIDER_MASK;
u32 d_SI_BASE_ADDRESS;
u32 d_SI_CONFIG_OFFSET;
u32 d_SI_TX_DATA0_OFFSET;
u32 d_SI_TX_DATA1_OFFSET;
u32 d_SI_RX_DATA0_OFFSET;
u32 d_SI_RX_DATA1_OFFSET;
u32 d_SI_CS_OFFSET;
u32 d_SI_CS_DONE_ERR_MASK;
u32 d_SI_CS_DONE_INT_MASK;
u32 d_SI_CS_START_LSB;
u32 d_SI_CS_START_MASK;
u32 d_SI_CS_RX_CNT_LSB;
u32 d_SI_CS_RX_CNT_MASK;
u32 d_SI_CS_TX_CNT_LSB;
u32 d_SI_CS_TX_CNT_MASK;
u32 d_BOARD_DATA_SZ;
u32 d_BOARD_EXT_DATA_SZ;
} TARGET_REGISTER_TABLE;
#define BOARD_DATA_SZ_MAX 2048

View File

@ -35,48 +35,48 @@ struct ieee80211_node_table;
struct ieee80211_frame;
struct ieee80211_common_ie {
A_UINT16 ie_chan;
A_UINT8 *ie_tstamp;
A_UINT8 *ie_ssid;
A_UINT8 *ie_rates;
A_UINT8 *ie_xrates;
A_UINT8 *ie_country;
A_UINT8 *ie_wpa;
A_UINT8 *ie_rsn;
A_UINT8 *ie_wmm;
A_UINT8 *ie_ath;
A_UINT16 ie_capInfo;
A_UINT16 ie_beaconInt;
A_UINT8 *ie_tim;
A_UINT8 *ie_chswitch;
A_UINT8 ie_erp;
A_UINT8 *ie_wsc;
A_UINT8 *ie_htcap;
A_UINT8 *ie_htop;
u16 ie_chan;
u8 *ie_tstamp;
u8 *ie_ssid;
u8 *ie_rates;
u8 *ie_xrates;
u8 *ie_country;
u8 *ie_wpa;
u8 *ie_rsn;
u8 *ie_wmm;
u8 *ie_ath;
u16 ie_capInfo;
u16 ie_beaconInt;
u8 *ie_tim;
u8 *ie_chswitch;
u8 ie_erp;
u8 *ie_wsc;
u8 *ie_htcap;
u8 *ie_htop;
#ifdef WAPI_ENABLE
A_UINT8 *ie_wapi;
u8 *ie_wapi;
#endif
};
typedef struct bss {
A_UINT8 ni_macaddr[6];
A_UINT8 ni_snr;
A_INT16 ni_rssi;
u8 ni_macaddr[6];
u8 ni_snr;
s16 ni_rssi;
struct bss *ni_list_next;
struct bss *ni_list_prev;
struct bss *ni_hash_next;
struct bss *ni_hash_prev;
struct ieee80211_common_ie ni_cie;
A_UINT8 *ni_buf;
A_UINT16 ni_framelen;
u8 *ni_buf;
u16 ni_framelen;
struct ieee80211_node_table *ni_table;
A_UINT32 ni_refcnt;
u32 ni_refcnt;
int ni_scangen;
A_UINT32 ni_tstamp;
A_UINT32 ni_actcnt;
u32 ni_tstamp;
u32 ni_actcnt;
#ifdef OS_ROAM_MANAGEMENT
A_UINT32 ni_si_gen;
u32 ni_si_gen;
#endif
} bss_t;
@ -85,8 +85,8 @@ typedef void wlan_node_iter_func(void *arg, bss_t *);
bss_t *wlan_node_alloc(struct ieee80211_node_table *nt, int wh_size);
void wlan_node_free(bss_t *ni);
void wlan_setup_node(struct ieee80211_node_table *nt, bss_t *ni,
const A_UINT8 *macaddr);
bss_t *wlan_find_node(struct ieee80211_node_table *nt, const A_UINT8 *macaddr);
const u8 *macaddr);
bss_t *wlan_find_node(struct ieee80211_node_table *nt, const u8 *macaddr);
void wlan_node_reclaim(struct ieee80211_node_table *nt, bss_t *ni);
void wlan_free_allnodes(struct ieee80211_node_table *nt);
void wlan_iterate_nodes(struct ieee80211_node_table *nt, wlan_node_iter_func *f,
@ -96,30 +96,30 @@ void wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt);
void wlan_node_table_reset(struct ieee80211_node_table *nt);
void wlan_node_table_cleanup(struct ieee80211_node_table *nt);
A_STATUS wlan_parse_beacon(A_UINT8 *buf, int framelen,
int wlan_parse_beacon(u8 *buf, int framelen,
struct ieee80211_common_ie *cie);
A_UINT16 wlan_ieee2freq(int chan);
A_UINT32 wlan_freq2ieee(A_UINT16 freq);
u16 wlan_ieee2freq(int chan);
u32 wlan_freq2ieee(u16 freq);
void wlan_set_nodeage(struct ieee80211_node_table *nt, A_UINT32 nodeAge);
void wlan_set_nodeage(struct ieee80211_node_table *nt, u32 nodeAge);
void
wlan_refresh_inactive_nodes (struct ieee80211_node_table *nt);
bss_t *
wlan_find_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid,
A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID);
wlan_find_Ssidnode (struct ieee80211_node_table *nt, u8 *pSsid,
u32 ssidLength, bool bIsWPA2, bool bMatchSSID);
void
wlan_node_return (struct ieee80211_node_table *nt, bss_t *ni);
bss_t *wlan_node_remove(struct ieee80211_node_table *nt, A_UINT8 *bssid);
bss_t *wlan_node_remove(struct ieee80211_node_table *nt, u8 *bssid);
bss_t *
wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, A_UCHAR *pSsid,
A_UINT32 ssidLength, A_UINT32 dot11AuthMode, A_UINT32 authMode,
A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp);
wlan_find_matching_Ssidnode (struct ieee80211_node_table *nt, u8 *pSsid,
u32 ssidLength, u32 dot11AuthMode, u32 authMode,
u32 pairwiseCryptoType, u32 grpwiseCryptoTyp);
#ifdef __cplusplus
}

View File

@ -69,26 +69,26 @@ void wmi_qos_state_init(struct wmi_t *wmip);
void wmi_shutdown(struct wmi_t *wmip);
HTC_ENDPOINT_ID wmi_get_control_ep(struct wmi_t * wmip);
void wmi_set_control_ep(struct wmi_t * wmip, HTC_ENDPOINT_ID eid);
A_UINT16 wmi_get_mapped_qos_queue(struct wmi_t *, A_UINT8);
A_STATUS wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf);
A_STATUS wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, A_UINT8 msgType, A_BOOL bMoreData, WMI_DATA_HDR_DATA_TYPE data_type,A_UINT8 metaVersion, void *pTxMetaS);
A_STATUS wmi_dot3_2_dix(void *osbuf);
u16 wmi_get_mapped_qos_queue(struct wmi_t *, u8 );
int wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf);
int wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, u8 msgType, bool bMoreData, WMI_DATA_HDR_DATA_TYPE data_type,u8 metaVersion, void *pTxMetaS);
int wmi_dot3_2_dix(void *osbuf);
A_STATUS wmi_dot11_hdr_remove (struct wmi_t *wmip, void *osbuf);
A_STATUS wmi_dot11_hdr_add(struct wmi_t *wmip, void *osbuf, NETWORK_TYPE mode);
int wmi_dot11_hdr_remove (struct wmi_t *wmip, void *osbuf);
int wmi_dot11_hdr_add(struct wmi_t *wmip, void *osbuf, NETWORK_TYPE mode);
A_STATUS wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf);
A_STATUS wmi_syncpoint(struct wmi_t *wmip);
A_STATUS wmi_syncpoint_reset(struct wmi_t *wmip);
A_UINT8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, A_UINT32 layer2Priority, A_BOOL wmmEnabled);
int wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf);
int wmi_syncpoint(struct wmi_t *wmip);
int wmi_syncpoint_reset(struct wmi_t *wmip);
u8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, u32 layer2Priority, bool wmmEnabled);
A_UINT8 wmi_determine_userPriority (A_UINT8 *pkt, A_UINT32 layer2Pri);
u8 wmi_determine_userPriority (u8 *pkt, u32 layer2Pri);
A_STATUS wmi_control_rx(struct wmi_t *wmip, void *osbuf);
int wmi_control_rx(struct wmi_t *wmip, void *osbuf);
void wmi_iterate_nodes(struct wmi_t *wmip, wlan_node_iter_func *f, void *arg);
void wmi_free_allnodes(struct wmi_t *wmip);
bss_t *wmi_find_node(struct wmi_t *wmip, const A_UINT8 *macaddr);
void wmi_free_node(struct wmi_t *wmip, const A_UINT8 *macaddr);
bss_t *wmi_find_node(struct wmi_t *wmip, const u8 *macaddr);
void wmi_free_node(struct wmi_t *wmip, const u8 *macaddr);
typedef enum {
@ -99,340 +99,340 @@ typedef enum {
END_WMIFLAG /* end marker */
} WMI_SYNC_FLAG;
A_STATUS wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId,
int wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId,
WMI_SYNC_FLAG flag);
A_STATUS wmi_connect_cmd(struct wmi_t *wmip,
int wmi_connect_cmd(struct wmi_t *wmip,
NETWORK_TYPE netType,
DOT11_AUTH_MODE dot11AuthMode,
AUTH_MODE authMode,
CRYPTO_TYPE pairwiseCrypto,
A_UINT8 pairwiseCryptoLen,
u8 pairwiseCryptoLen,
CRYPTO_TYPE groupCrypto,
A_UINT8 groupCryptoLen,
u8 groupCryptoLen,
int ssidLength,
A_UCHAR *ssid,
A_UINT8 *bssid,
A_UINT16 channel,
A_UINT32 ctrl_flags);
u8 *ssid,
u8 *bssid,
u16 channel,
u32 ctrl_flags);
A_STATUS wmi_reconnect_cmd(struct wmi_t *wmip,
A_UINT8 *bssid,
A_UINT16 channel);
A_STATUS wmi_disconnect_cmd(struct wmi_t *wmip);
A_STATUS wmi_getrev_cmd(struct wmi_t *wmip);
A_STATUS wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType,
A_BOOL forceFgScan, A_BOOL isLegacy,
A_UINT32 homeDwellTime, A_UINT32 forceScanInterval,
A_INT8 numChan, A_UINT16 *channelList);
A_STATUS wmi_scanparams_cmd(struct wmi_t *wmip, A_UINT16 fg_start_sec,
A_UINT16 fg_end_sec, A_UINT16 bg_sec,
A_UINT16 minact_chdw_msec,
A_UINT16 maxact_chdw_msec, A_UINT16 pas_chdw_msec,
A_UINT8 shScanRatio, A_UINT8 scanCtrlFlags,
A_UINT32 max_dfsch_act_time,
A_UINT16 maxact_scan_per_ssid);
A_STATUS wmi_bssfilter_cmd(struct wmi_t *wmip, A_UINT8 filter, A_UINT32 ieMask);
A_STATUS wmi_probedSsid_cmd(struct wmi_t *wmip, A_UINT8 index, A_UINT8 flag,
A_UINT8 ssidLength, A_UCHAR *ssid);
A_STATUS wmi_listeninterval_cmd(struct wmi_t *wmip, A_UINT16 listenInterval, A_UINT16 listenBeacons);
A_STATUS wmi_bmisstime_cmd(struct wmi_t *wmip, A_UINT16 bmisstime, A_UINT16 bmissbeacons);
A_STATUS wmi_associnfo_cmd(struct wmi_t *wmip, A_UINT8 ieType,
A_UINT8 ieLen, A_UINT8 *ieInfo);
A_STATUS wmi_powermode_cmd(struct wmi_t *wmip, A_UINT8 powerMode);
A_STATUS wmi_ibsspmcaps_cmd(struct wmi_t *wmip, A_UINT8 pmEnable, A_UINT8 ttl,
A_UINT16 atim_windows, A_UINT16 timeout_value);
A_STATUS wmi_apps_cmd(struct wmi_t *wmip, A_UINT8 psType, A_UINT32 idle_time,
A_UINT32 ps_period, A_UINT8 sleep_period);
A_STATUS wmi_pmparams_cmd(struct wmi_t *wmip, A_UINT16 idlePeriod,
A_UINT16 psPollNum, A_UINT16 dtimPolicy,
A_UINT16 wakup_tx_policy, A_UINT16 num_tx_to_wakeup,
A_UINT16 ps_fail_event_policy);
A_STATUS wmi_disctimeout_cmd(struct wmi_t *wmip, A_UINT8 timeout);
A_STATUS wmi_sync_cmd(struct wmi_t *wmip, A_UINT8 syncNumber);
A_STATUS wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *pstream);
A_STATUS wmi_delete_pstream_cmd(struct wmi_t *wmip, A_UINT8 trafficClass, A_UINT8 streamID);
A_STATUS wmi_set_framerate_cmd(struct wmi_t *wmip, A_UINT8 bEnable, A_UINT8 type, A_UINT8 subType, A_UINT16 rateMask);
A_STATUS wmi_set_bitrate_cmd(struct wmi_t *wmip, A_INT32 dataRate, A_INT32 mgmtRate, A_INT32 ctlRate);
A_STATUS wmi_get_bitrate_cmd(struct wmi_t *wmip);
A_INT8 wmi_validate_bitrate(struct wmi_t *wmip, A_INT32 rate, A_INT8 *rate_idx);
A_STATUS wmi_get_regDomain_cmd(struct wmi_t *wmip);
A_STATUS wmi_get_channelList_cmd(struct wmi_t *wmip);
A_STATUS wmi_set_channelParams_cmd(struct wmi_t *wmip, A_UINT8 scanParam,
WMI_PHY_MODE mode, A_INT8 numChan,
A_UINT16 *channelList);
int wmi_reconnect_cmd(struct wmi_t *wmip,
u8 *bssid,
u16 channel);
int wmi_disconnect_cmd(struct wmi_t *wmip);
int wmi_getrev_cmd(struct wmi_t *wmip);
int wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType,
u32 forceFgScan, u32 isLegacy,
u32 homeDwellTime, u32 forceScanInterval,
s8 numChan, u16 *channelList);
int wmi_scanparams_cmd(struct wmi_t *wmip, u16 fg_start_sec,
u16 fg_end_sec, u16 bg_sec,
u16 minact_chdw_msec,
u16 maxact_chdw_msec, u16 pas_chdw_msec,
u8 shScanRatio, u8 scanCtrlFlags,
u32 max_dfsch_act_time,
u16 maxact_scan_per_ssid);
int wmi_bssfilter_cmd(struct wmi_t *wmip, u8 filter, u32 ieMask);
int wmi_probedSsid_cmd(struct wmi_t *wmip, u8 index, u8 flag,
u8 ssidLength, u8 *ssid);
int wmi_listeninterval_cmd(struct wmi_t *wmip, u16 listenInterval, u16 listenBeacons);
int wmi_bmisstime_cmd(struct wmi_t *wmip, u16 bmisstime, u16 bmissbeacons);
int wmi_associnfo_cmd(struct wmi_t *wmip, u8 ieType,
u8 ieLen, u8 *ieInfo);
int wmi_powermode_cmd(struct wmi_t *wmip, u8 powerMode);
int wmi_ibsspmcaps_cmd(struct wmi_t *wmip, u8 pmEnable, u8 ttl,
u16 atim_windows, u16 timeout_value);
int wmi_apps_cmd(struct wmi_t *wmip, u8 psType, u32 idle_time,
u32 ps_period, u8 sleep_period);
int wmi_pmparams_cmd(struct wmi_t *wmip, u16 idlePeriod,
u16 psPollNum, u16 dtimPolicy,
u16 wakup_tx_policy, u16 num_tx_to_wakeup,
u16 ps_fail_event_policy);
int wmi_disctimeout_cmd(struct wmi_t *wmip, u8 timeout);
int wmi_sync_cmd(struct wmi_t *wmip, u8 syncNumber);
int wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *pstream);
int wmi_delete_pstream_cmd(struct wmi_t *wmip, u8 trafficClass, u8 streamID);
int wmi_set_framerate_cmd(struct wmi_t *wmip, u8 bEnable, u8 type, u8 subType, u16 rateMask);
int wmi_set_bitrate_cmd(struct wmi_t *wmip, s32 dataRate, s32 mgmtRate, s32 ctlRate);
int wmi_get_bitrate_cmd(struct wmi_t *wmip);
s8 wmi_validate_bitrate(struct wmi_t *wmip, s32 rate, s8 *rate_idx);
int wmi_get_regDomain_cmd(struct wmi_t *wmip);
int wmi_get_channelList_cmd(struct wmi_t *wmip);
int wmi_set_channelParams_cmd(struct wmi_t *wmip, u8 scanParam,
WMI_PHY_MODE mode, s8 numChan,
u16 *channelList);
A_STATUS wmi_set_snr_threshold_params(struct wmi_t *wmip,
int wmi_set_snr_threshold_params(struct wmi_t *wmip,
WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd);
A_STATUS wmi_set_rssi_threshold_params(struct wmi_t *wmip,
int wmi_set_rssi_threshold_params(struct wmi_t *wmip,
WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd);
A_STATUS wmi_clr_rssi_snr(struct wmi_t *wmip);
A_STATUS wmi_set_lq_threshold_params(struct wmi_t *wmip,
int wmi_clr_rssi_snr(struct wmi_t *wmip);
int wmi_set_lq_threshold_params(struct wmi_t *wmip,
WMI_LQ_THRESHOLD_PARAMS_CMD *lqCmd);
A_STATUS wmi_set_rts_cmd(struct wmi_t *wmip, A_UINT16 threshold);
A_STATUS wmi_set_lpreamble_cmd(struct wmi_t *wmip, A_UINT8 status, A_UINT8 preamblePolicy);
int wmi_set_rts_cmd(struct wmi_t *wmip, u16 threshold);
int wmi_set_lpreamble_cmd(struct wmi_t *wmip, u8 status, u8 preamblePolicy);
A_STATUS wmi_set_error_report_bitmask(struct wmi_t *wmip, A_UINT32 bitmask);
int wmi_set_error_report_bitmask(struct wmi_t *wmip, u32 bitmask);
A_STATUS wmi_get_challenge_resp_cmd(struct wmi_t *wmip, A_UINT32 cookie,
A_UINT32 source);
int wmi_get_challenge_resp_cmd(struct wmi_t *wmip, u32 cookie,
u32 source);
A_STATUS wmi_config_debug_module_cmd(struct wmi_t *wmip, A_UINT16 mmask,
A_UINT16 tsr, A_BOOL rep, A_UINT16 size,
A_UINT32 valid);
int wmi_config_debug_module_cmd(struct wmi_t *wmip, u16 mmask,
u16 tsr, bool rep, u16 size,
u32 valid);
A_STATUS wmi_get_stats_cmd(struct wmi_t *wmip);
int wmi_get_stats_cmd(struct wmi_t *wmip);
A_STATUS wmi_addKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex,
CRYPTO_TYPE keyType, A_UINT8 keyUsage,
A_UINT8 keyLength,A_UINT8 *keyRSC,
A_UINT8 *keyMaterial, A_UINT8 key_op_ctrl, A_UINT8 *mac,
int wmi_addKey_cmd(struct wmi_t *wmip, u8 keyIndex,
CRYPTO_TYPE keyType, u8 keyUsage,
u8 keyLength,u8 *keyRSC,
u8 *keyMaterial, u8 key_op_ctrl, u8 *mac,
WMI_SYNC_FLAG sync_flag);
A_STATUS wmi_add_krk_cmd(struct wmi_t *wmip, A_UINT8 *krk);
A_STATUS wmi_delete_krk_cmd(struct wmi_t *wmip);
A_STATUS wmi_deleteKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex);
A_STATUS wmi_set_akmp_params_cmd(struct wmi_t *wmip,
int wmi_add_krk_cmd(struct wmi_t *wmip, u8 *krk);
int wmi_delete_krk_cmd(struct wmi_t *wmip);
int wmi_deleteKey_cmd(struct wmi_t *wmip, u8 keyIndex);
int wmi_set_akmp_params_cmd(struct wmi_t *wmip,
WMI_SET_AKMP_PARAMS_CMD *akmpParams);
A_STATUS wmi_get_pmkid_list_cmd(struct wmi_t *wmip);
A_STATUS wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
int wmi_get_pmkid_list_cmd(struct wmi_t *wmip);
int wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
WMI_SET_PMKID_LIST_CMD *pmkInfo);
A_STATUS wmi_abort_scan_cmd(struct wmi_t *wmip);
A_STATUS wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM);
A_STATUS wmi_get_txPwr_cmd(struct wmi_t *wmip);
A_STATUS wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid);
A_STATUS wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex);
A_STATUS wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en);
A_STATUS wmi_setPmkid_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT8 *pmkId,
A_BOOL set);
A_STATUS wmi_set_access_params_cmd(struct wmi_t *wmip, A_UINT8 ac, A_UINT16 txop,
A_UINT8 eCWmin, A_UINT8 eCWmax,
A_UINT8 aifsn);
A_STATUS wmi_set_retry_limits_cmd(struct wmi_t *wmip, A_UINT8 frameType,
A_UINT8 trafficClass, A_UINT8 maxRetries,
A_UINT8 enableNotify);
int wmi_abort_scan_cmd(struct wmi_t *wmip);
int wmi_set_txPwr_cmd(struct wmi_t *wmip, u8 dbM);
int wmi_get_txPwr_cmd(struct wmi_t *wmip);
int wmi_addBadAp_cmd(struct wmi_t *wmip, u8 apIndex, u8 *bssid);
int wmi_deleteBadAp_cmd(struct wmi_t *wmip, u8 apIndex);
int wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, bool en);
int wmi_setPmkid_cmd(struct wmi_t *wmip, u8 *bssid, u8 *pmkId,
bool set);
int wmi_set_access_params_cmd(struct wmi_t *wmip, u8 ac, u16 txop,
u8 eCWmin, u8 eCWmax,
u8 aifsn);
int wmi_set_retry_limits_cmd(struct wmi_t *wmip, u8 frameType,
u8 trafficClass, u8 maxRetries,
u8 enableNotify);
void wmi_get_current_bssid(struct wmi_t *wmip, A_UINT8 *bssid);
void wmi_get_current_bssid(struct wmi_t *wmip, u8 *bssid);
A_STATUS wmi_get_roam_tbl_cmd(struct wmi_t *wmip);
A_STATUS wmi_get_roam_data_cmd(struct wmi_t *wmip, A_UINT8 roamDataType);
A_STATUS wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p,
A_UINT8 size);
A_STATUS wmi_set_powersave_timers_cmd(struct wmi_t *wmip,
int wmi_get_roam_tbl_cmd(struct wmi_t *wmip);
int wmi_get_roam_data_cmd(struct wmi_t *wmip, u8 roamDataType);
int wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p,
u8 size);
int wmi_set_powersave_timers_cmd(struct wmi_t *wmip,
WMI_POWERSAVE_TIMERS_POLICY_CMD *pCmd,
A_UINT8 size);
u8 size);
A_STATUS wmi_set_opt_mode_cmd(struct wmi_t *wmip, A_UINT8 optMode);
A_STATUS wmi_opt_tx_frame_cmd(struct wmi_t *wmip,
A_UINT8 frmType,
A_UINT8 *dstMacAddr,
A_UINT8 *bssid,
A_UINT16 optIEDataLen,
A_UINT8 *optIEData);
int wmi_set_opt_mode_cmd(struct wmi_t *wmip, u8 optMode);
int wmi_opt_tx_frame_cmd(struct wmi_t *wmip,
u8 frmType,
u8 *dstMacAddr,
u8 *bssid,
u16 optIEDataLen,
u8 *optIEData);
A_STATUS wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, A_UINT16 intvl);
A_STATUS wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, A_UINT16 voicePktSize);
A_STATUS wmi_set_max_sp_len_cmd(struct wmi_t *wmip, A_UINT8 maxSpLen);
A_UINT8 convert_userPriority_to_trafficClass(A_UINT8 userPriority);
A_UINT8 wmi_get_power_mode_cmd(struct wmi_t *wmip);
A_STATUS wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, A_BOOL tspecCompliance);
int wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, u16 intvl);
int wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, u16 voicePktSize);
int wmi_set_max_sp_len_cmd(struct wmi_t *wmip, u8 maxSpLen);
u8 convert_userPriority_to_trafficClass(u8 userPriority);
u8 wmi_get_power_mode_cmd(struct wmi_t *wmip);
int wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, int tspecCompliance);
#ifdef CONFIG_HOST_TCMD_SUPPORT
A_STATUS wmi_test_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT32 len);
int wmi_test_cmd(struct wmi_t *wmip, u8 *buf, u32 len);
#endif
A_STATUS wmi_set_bt_status_cmd(struct wmi_t *wmip, A_UINT8 streamType, A_UINT8 status);
A_STATUS wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd);
int wmi_set_bt_status_cmd(struct wmi_t *wmip, u8 streamType, u8 status);
int wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd);
A_STATUS wmi_set_btcoex_fe_ant_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_FE_ANT_CMD * cmd);
int wmi_set_btcoex_fe_ant_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_FE_ANT_CMD * cmd);
A_STATUS wmi_set_btcoex_colocated_bt_dev_cmd(struct wmi_t *wmip,
int wmi_set_btcoex_colocated_bt_dev_cmd(struct wmi_t *wmip,
WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD * cmd);
A_STATUS wmi_set_btcoex_btinquiry_page_config_cmd(struct wmi_t *wmip,
int wmi_set_btcoex_btinquiry_page_config_cmd(struct wmi_t *wmip,
WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *cmd);
A_STATUS wmi_set_btcoex_sco_config_cmd(struct wmi_t *wmip,
int wmi_set_btcoex_sco_config_cmd(struct wmi_t *wmip,
WMI_SET_BTCOEX_SCO_CONFIG_CMD * cmd);
A_STATUS wmi_set_btcoex_a2dp_config_cmd(struct wmi_t *wmip,
int wmi_set_btcoex_a2dp_config_cmd(struct wmi_t *wmip,
WMI_SET_BTCOEX_A2DP_CONFIG_CMD* cmd);
A_STATUS wmi_set_btcoex_aclcoex_config_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD* cmd);
int wmi_set_btcoex_aclcoex_config_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD* cmd);
A_STATUS wmi_set_btcoex_debug_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_DEBUG_CMD * cmd);
int wmi_set_btcoex_debug_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_DEBUG_CMD * cmd);
A_STATUS wmi_set_btcoex_bt_operating_status_cmd(struct wmi_t * wmip,
int wmi_set_btcoex_bt_operating_status_cmd(struct wmi_t * wmip,
WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD * cmd);
A_STATUS wmi_get_btcoex_config_cmd(struct wmi_t * wmip, WMI_GET_BTCOEX_CONFIG_CMD * cmd);
int wmi_get_btcoex_config_cmd(struct wmi_t * wmip, WMI_GET_BTCOEX_CONFIG_CMD * cmd);
A_STATUS wmi_get_btcoex_stats_cmd(struct wmi_t * wmip);
int wmi_get_btcoex_stats_cmd(struct wmi_t * wmip);
A_STATUS wmi_SGI_cmd(struct wmi_t *wmip, A_UINT32 sgiMask, A_UINT8 sgiPERThreshold);
int wmi_SGI_cmd(struct wmi_t *wmip, u32 sgiMask, u8 sgiPERThreshold);
/*
* This function is used to configure the fix rates mask to the target.
*/
A_STATUS wmi_set_fixrates_cmd(struct wmi_t *wmip, A_UINT32 fixRatesMask);
A_STATUS wmi_get_ratemask_cmd(struct wmi_t *wmip);
int wmi_set_fixrates_cmd(struct wmi_t *wmip, u32 fixRatesMask);
int wmi_get_ratemask_cmd(struct wmi_t *wmip);
A_STATUS wmi_set_authmode_cmd(struct wmi_t *wmip, A_UINT8 mode);
int wmi_set_authmode_cmd(struct wmi_t *wmip, u8 mode);
A_STATUS wmi_set_reassocmode_cmd(struct wmi_t *wmip, A_UINT8 mode);
int wmi_set_reassocmode_cmd(struct wmi_t *wmip, u8 mode);
A_STATUS wmi_set_qos_supp_cmd(struct wmi_t *wmip,A_UINT8 status);
A_STATUS wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status);
A_STATUS wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG txEnable);
A_STATUS wmi_set_country(struct wmi_t *wmip, A_UCHAR *countryCode);
int wmi_set_qos_supp_cmd(struct wmi_t *wmip,u8 status);
int wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status);
int wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG txEnable);
int wmi_set_country(struct wmi_t *wmip, u8 *countryCode);
A_STATUS wmi_get_keepalive_configured(struct wmi_t *wmip);
A_UINT8 wmi_get_keepalive_cmd(struct wmi_t *wmip);
A_STATUS wmi_set_keepalive_cmd(struct wmi_t *wmip, A_UINT8 keepaliveInterval);
int wmi_get_keepalive_configured(struct wmi_t *wmip);
u8 wmi_get_keepalive_cmd(struct wmi_t *wmip);
int wmi_set_keepalive_cmd(struct wmi_t *wmip, u8 keepaliveInterval);
A_STATUS wmi_set_appie_cmd(struct wmi_t *wmip, A_UINT8 mgmtFrmType,
A_UINT8 ieLen,A_UINT8 *ieInfo);
int wmi_set_appie_cmd(struct wmi_t *wmip, u8 mgmtFrmType,
u8 ieLen,u8 *ieInfo);
A_STATUS wmi_set_halparam_cmd(struct wmi_t *wmip, A_UINT8 *cmd, A_UINT16 dataLen);
int wmi_set_halparam_cmd(struct wmi_t *wmip, u8 *cmd, u16 dataLen);
A_INT32 wmi_get_rate(A_INT8 rateindex);
s32 wmi_get_rate(s8 rateindex);
A_STATUS wmi_set_ip_cmd(struct wmi_t *wmip, WMI_SET_IP_CMD *cmd);
int wmi_set_ip_cmd(struct wmi_t *wmip, WMI_SET_IP_CMD *cmd);
/*Wake on Wireless WMI commands*/
A_STATUS wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, WMI_SET_HOST_SLEEP_MODE_CMD *cmd);
A_STATUS wmi_set_wow_mode_cmd(struct wmi_t *wmip, WMI_SET_WOW_MODE_CMD *cmd);
A_STATUS wmi_get_wow_list_cmd(struct wmi_t *wmip, WMI_GET_WOW_LIST_CMD *cmd);
A_STATUS wmi_add_wow_pattern_cmd(struct wmi_t *wmip,
WMI_ADD_WOW_PATTERN_CMD *cmd, A_UINT8* pattern, A_UINT8* mask, A_UINT8 pattern_size);
A_STATUS wmi_del_wow_pattern_cmd(struct wmi_t *wmip,
int wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, WMI_SET_HOST_SLEEP_MODE_CMD *cmd);
int wmi_set_wow_mode_cmd(struct wmi_t *wmip, WMI_SET_WOW_MODE_CMD *cmd);
int wmi_get_wow_list_cmd(struct wmi_t *wmip, WMI_GET_WOW_LIST_CMD *cmd);
int wmi_add_wow_pattern_cmd(struct wmi_t *wmip,
WMI_ADD_WOW_PATTERN_CMD *cmd, u8 *pattern, u8 *mask, u8 pattern_size);
int wmi_del_wow_pattern_cmd(struct wmi_t *wmip,
WMI_DEL_WOW_PATTERN_CMD *cmd);
A_STATUS wmi_set_wsc_status_cmd(struct wmi_t *wmip, A_UINT32 status);
int wmi_set_wsc_status_cmd(struct wmi_t *wmip, u32 status);
A_STATUS
wmi_set_params_cmd(struct wmi_t *wmip, A_UINT32 opcode, A_UINT32 length, A_CHAR* buffer);
int
wmi_set_params_cmd(struct wmi_t *wmip, u32 opcode, u32 length, char *buffer);
A_STATUS
wmi_set_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4);
int
wmi_set_mcast_filter_cmd(struct wmi_t *wmip, u8 dot1, u8 dot2, u8 dot3, u8 dot4);
A_STATUS
wmi_del_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 dot1, A_UINT8 dot2, A_UINT8 dot3, A_UINT8 dot4);
int
wmi_del_mcast_filter_cmd(struct wmi_t *wmip, u8 dot1, u8 dot2, u8 dot3, u8 dot4);
A_STATUS
wmi_mcast_filter_cmd(struct wmi_t *wmip, A_UINT8 enable);
int
wmi_mcast_filter_cmd(struct wmi_t *wmip, u8 enable);
bss_t *
wmi_find_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid,
A_UINT32 ssidLength, A_BOOL bIsWPA2, A_BOOL bMatchSSID);
wmi_find_Ssidnode (struct wmi_t *wmip, u8 *pSsid,
u32 ssidLength, bool bIsWPA2, bool bMatchSSID);
void
wmi_node_return (struct wmi_t *wmip, bss_t *bss);
void
wmi_set_nodeage(struct wmi_t *wmip, A_UINT32 nodeAge);
wmi_set_nodeage(struct wmi_t *wmip, u32 nodeAge);
#if defined(CONFIG_TARGET_PROFILE_SUPPORT)
A_STATUS wmi_prof_cfg_cmd(struct wmi_t *wmip, A_UINT32 period, A_UINT32 nbins);
A_STATUS wmi_prof_addr_set_cmd(struct wmi_t *wmip, A_UINT32 addr);
A_STATUS wmi_prof_start_cmd(struct wmi_t *wmip);
A_STATUS wmi_prof_stop_cmd(struct wmi_t *wmip);
A_STATUS wmi_prof_count_get_cmd(struct wmi_t *wmip);
int wmi_prof_cfg_cmd(struct wmi_t *wmip, u32 period, u32 nbins);
int wmi_prof_addr_set_cmd(struct wmi_t *wmip, u32 addr);
int wmi_prof_start_cmd(struct wmi_t *wmip);
int wmi_prof_stop_cmd(struct wmi_t *wmip);
int wmi_prof_count_get_cmd(struct wmi_t *wmip);
#endif /* CONFIG_TARGET_PROFILE_SUPPORT */
#ifdef OS_ROAM_MANAGEMENT
void wmi_scan_indication (struct wmi_t *wmip);
#endif
A_STATUS
int
wmi_set_target_event_report_cmd(struct wmi_t *wmip, WMI_SET_TARGET_EVENT_REPORT_CMD* cmd);
bss_t *wmi_rm_current_bss (struct wmi_t *wmip, A_UINT8 *id);
A_STATUS wmi_add_current_bss (struct wmi_t *wmip, A_UINT8 *id, bss_t *bss);
bss_t *wmi_rm_current_bss (struct wmi_t *wmip, u8 *id);
int wmi_add_current_bss (struct wmi_t *wmip, u8 *id, bss_t *bss);
/*
* AP mode
*/
A_STATUS
int
wmi_ap_profile_commit(struct wmi_t *wmip, WMI_CONNECT_CMD *p);
A_STATUS
wmi_ap_set_hidden_ssid(struct wmi_t *wmip, A_UINT8 hidden_ssid);
int
wmi_ap_set_hidden_ssid(struct wmi_t *wmip, u8 hidden_ssid);
A_STATUS
wmi_ap_set_num_sta(struct wmi_t *wmip, A_UINT8 num_sta);
int
wmi_ap_set_num_sta(struct wmi_t *wmip, u8 num_sta);
A_STATUS
wmi_ap_set_acl_policy(struct wmi_t *wmip, A_UINT8 policy);
int
wmi_ap_set_acl_policy(struct wmi_t *wmip, u8 policy);
A_STATUS
int
wmi_ap_acl_mac_list(struct wmi_t *wmip, WMI_AP_ACL_MAC_CMD *a);
A_UINT8
acl_add_del_mac(WMI_AP_ACL *a, WMI_AP_ACL_MAC_CMD *acl);
u8 acl_add_del_mac(WMI_AP_ACL *a, WMI_AP_ACL_MAC_CMD *acl);
A_STATUS
wmi_ap_set_mlme(struct wmi_t *wmip, A_UINT8 cmd, A_UINT8 *mac, A_UINT16 reason);
int
wmi_ap_set_mlme(struct wmi_t *wmip, u8 cmd, u8 *mac, u16 reason);
A_STATUS
wmi_set_pvb_cmd(struct wmi_t *wmip, A_UINT16 aid, A_BOOL flag);
int
wmi_set_pvb_cmd(struct wmi_t *wmip, u16 aid, bool flag);
A_STATUS
wmi_ap_conn_inact_time(struct wmi_t *wmip, A_UINT32 period);
int
wmi_ap_conn_inact_time(struct wmi_t *wmip, u32 period);
A_STATUS
wmi_ap_bgscan_time(struct wmi_t *wmip, A_UINT32 period, A_UINT32 dwell);
int
wmi_ap_bgscan_time(struct wmi_t *wmip, u32 period, u32 dwell);
A_STATUS
wmi_ap_set_dtim(struct wmi_t *wmip, A_UINT8 dtim);
int
wmi_ap_set_dtim(struct wmi_t *wmip, u8 dtim);
A_STATUS
wmi_ap_set_rateset(struct wmi_t *wmip, A_UINT8 rateset);
int
wmi_ap_set_rateset(struct wmi_t *wmip, u8 rateset);
A_STATUS
int
wmi_set_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd);
A_STATUS
wmi_set_ht_op_cmd(struct wmi_t *wmip, A_UINT8 sta_chan_width);
int
wmi_set_ht_op_cmd(struct wmi_t *wmip, u8 sta_chan_width);
A_STATUS
wmi_send_hci_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT16 sz);
int
wmi_send_hci_cmd(struct wmi_t *wmip, u8 *buf, u16 sz);
A_STATUS
wmi_set_tx_select_rates_cmd(struct wmi_t *wmip, A_UINT32 *pMaskArray);
int
wmi_set_tx_select_rates_cmd(struct wmi_t *wmip, u32 *pMaskArray);
A_STATUS
wmi_setup_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid);
int
wmi_setup_aggr_cmd(struct wmi_t *wmip, u8 tid);
A_STATUS
wmi_delete_aggr_cmd(struct wmi_t *wmip, A_UINT8 tid, A_BOOL uplink);
int
wmi_delete_aggr_cmd(struct wmi_t *wmip, u8 tid, bool uplink);
A_STATUS
wmi_allow_aggr_cmd(struct wmi_t *wmip, A_UINT16 tx_tidmask, A_UINT16 rx_tidmask);
int
wmi_allow_aggr_cmd(struct wmi_t *wmip, u16 tx_tidmask, u16 rx_tidmask);
A_STATUS
wmi_set_rx_frame_format_cmd(struct wmi_t *wmip, A_UINT8 rxMetaVersion, A_BOOL rxDot11Hdr, A_BOOL defragOnHost);
int
wmi_set_rx_frame_format_cmd(struct wmi_t *wmip, u8 rxMetaVersion, bool rxDot11Hdr, bool defragOnHost);
A_STATUS
wmi_set_thin_mode_cmd(struct wmi_t *wmip, A_BOOL bThinMode);
int
wmi_set_thin_mode_cmd(struct wmi_t *wmip, bool bThinMode);
A_STATUS
int
wmi_set_wlan_conn_precedence_cmd(struct wmi_t *wmip, BT_WLAN_CONN_PRECEDENCE precedence);
A_STATUS
wmi_set_pmk_cmd(struct wmi_t *wmip, A_UINT8 *pmk);
int
wmi_set_pmk_cmd(struct wmi_t *wmip, u8 *pmk);
A_UINT16
wmi_ieee2freq (int chan);
int
wmi_set_excess_tx_retry_thres_cmd(struct wmi_t *wmip, WMI_SET_EXCESS_TX_RETRY_THRES_CMD *cmd);
A_UINT32
wmi_freq2ieee (A_UINT16 freq);
u16 wmi_ieee2freq (int chan);
u32 wmi_freq2ieee (u16 freq);
bss_t *
wmi_find_matching_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid,
A_UINT32 ssidLength,
A_UINT32 dot11AuthMode, A_UINT32 authMode,
A_UINT32 pairwiseCryptoType, A_UINT32 grpwiseCryptoTyp);
wmi_find_matching_Ssidnode (struct wmi_t *wmip, u8 *pSsid,
u32 ssidLength,
u32 dot11AuthMode, u32 authMode,
u32 pairwiseCryptoType, u32 grpwiseCryptoTyp);
#ifdef __cplusplus
}

View File

@ -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));

View File

@ -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 @@ int PSSendOps(void *arg)
* 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:

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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, &regDumpArea);
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 *)&regDumpValues[0],
regDumpCount * (sizeof(A_UINT32)));
(u8 *)&regDumpValues[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;
}

View File

@ -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;
}

View File

@ -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
};

View File

@ -25,14 +25,11 @@
#include <linux/vmalloc.h>
#include <linux/fs.h>
#ifdef CONFIG_HAS_WAKELOCK
#include <linux/wakelock.h>
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
A_BOOL enable_mmc_host_detect_change = 0;
bool enable_mmc_host_detect_change = false;
static void ar6000_enable_mmchost_detect_change(int enable);
@ -44,11 +41,6 @@ extern int bmienable;
extern struct net_device *ar6000_devices[];
extern char ifname[];
#ifdef CONFIG_HAS_WAKELOCK
extern struct wake_lock ar6k_wow_wake_lock;
struct wake_lock ar6k_init_wake_lock;
#endif
const char def_ifname[] = "wlan0";
module_param_string(fwpath, fwpath, sizeof(fwpath), 0644);
module_param(enablelogcat, uint, 0644);
@ -59,7 +51,7 @@ static int screen_is_off;
static struct early_suspend ar6k_early_suspend;
#endif
static A_STATUS (*ar6000_avail_ev_p)(void *, void *);
static int (*ar6000_avail_ev_p)(void *, void *);
#if defined(CONFIG_ANDROID_LOGGER) && (!defined(CONFIG_MMC_MSM))
int logger_write(const enum logidx index,
@ -128,9 +120,7 @@ int logger_write(const enum logidx index,
}
set_fs(oldfs);
out_free_message:
if (msg) {
kfree(msg);
}
kfree(msg);
return ret;
}
#endif
@ -163,7 +153,7 @@ int android_logger_lv(void *module, int mask)
}
}
static int android_readwrite_file(const A_CHAR *filename, A_CHAR *rbuf, const A_CHAR *wbuf, size_t length)
static int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length)
{
int ret = 0;
struct file *filp = (struct file *)-ENOENT;
@ -277,17 +267,11 @@ void android_release_firmware(const struct firmware *firmware)
}
}
static A_STATUS ar6000_android_avail_ev(void *context, void *hif_handle)
static int ar6000_android_avail_ev(void *context, void *hif_handle)
{
A_STATUS ret;
#ifdef CONFIG_HAS_WAKELOCK
wake_lock(&ar6k_init_wake_lock);
#endif
int ret;
ar6000_enable_mmchost_detect_change(0);
ret = ar6000_avail_ev_p(context, hif_handle);
#ifdef CONFIG_HAS_WAKELOCK
wake_unlock(&ar6k_init_wake_lock);
#endif
return ret;
}
@ -328,9 +312,6 @@ void android_module_init(OSDRV_CALLBACKS *osdrvCallbacks)
bmienable = 1;
if (ifname[0] == '\0')
strcpy(ifname, def_ifname);
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&ar6k_init_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_init");
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
ar6k_early_suspend.suspend = android_early_suspend;
ar6k_early_suspend.resume = android_late_resume;
@ -348,29 +329,26 @@ void android_module_exit(void)
{
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&ar6k_early_suspend);
#endif
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_destroy(&ar6k_init_wake_lock);
#endif
ar6000_enable_mmchost_detect_change(1);
}
#ifdef CONFIG_PM
void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent)
void android_ar6k_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent)
{
if (
#ifdef CONFIG_HAS_EARLYSUSPEND
screen_is_off &&
#endif
skb && ar->arConnected) {
A_BOOL needWake = FALSE;
bool needWake = false;
if (isEvent) {
if (A_NETBUF_LEN(skb) >= sizeof(A_UINT16)) {
A_UINT16 cmd = *(const A_UINT16 *)A_NETBUF_DATA(skb);
if (A_NETBUF_LEN(skb) >= sizeof(u16)) {
u16 cmd = *(const u16 *)A_NETBUF_DATA(skb);
switch (cmd) {
case WMI_CONNECT_EVENTID:
case WMI_DISCONNECT_EVENTID:
needWake = TRUE;
needWake = true;
break;
default:
/* dont wake lock the system for other event */
@ -385,7 +363,7 @@ void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL i
case 0x888e: /* EAPOL */
case 0x88c7: /* RSN_PREAUTH */
case 0x88b4: /* WAPI */
needWake = TRUE;
needWake = true;
break;
case 0x0806: /* ARP is not important to hold wake lock */
default:
@ -395,9 +373,6 @@ void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL i
}
if (needWake) {
/* keep host wake up if there is any event and packate comming in*/
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_timeout(&ar6k_wow_wake_lock, 3*HZ);
#endif
if (wowledon) {
char buf[32];
int len = sprintf(buf, "on");

File diff suppressed because it is too large Load Diff

View File

@ -30,32 +30,21 @@
#include <linux/platform_device.h>
#include "wlan_config.h"
#ifdef CONFIG_HAS_WAKELOCK
#include <linux/wakelock.h>
#endif
#define WOW_ENABLE_MAX_INTERVAL 0
#define WOW_SET_SCAN_PARAMS 0
extern unsigned int wmitimeout;
extern wait_queue_head_t arEvent;
#ifdef CONFIG_PM
#ifdef CONFIG_HAS_WAKELOCK
struct wake_lock ar6k_suspend_wake_lock;
struct wake_lock ar6k_wow_wake_lock;
#endif
#endif /* CONFIG_PM */
#ifdef ANDROID_ENV
extern void android_ar6k_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent);
extern void android_ar6k_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent);
#endif
#undef ATH_MODULE_NAME
#define ATH_MODULE_NAME pm
#define ATH_DEBUG_PM ATH_DEBUG_MAKE_MODULE_MASK(0)
#ifdef DEBUG
static ATH_DEBUG_MASK_DESCRIPTION pm_debug_desc[] = {
static struct ath_debug_mask_description pm_debug_desc[] = {
{ ATH_DEBUG_PM , "System power management"},
};
@ -68,10 +57,10 @@ ATH_DEBUG_INSTANTIATE_MODULE_VAR(pm,
#endif /* DEBUG */
A_STATUS ar6000_exit_cut_power_state(AR_SOFTC_T *ar);
int ar6000_exit_cut_power_state(struct ar6_softc *ar);
#ifdef CONFIG_PM
static void ar6k_send_asleep_event_to_app(AR_SOFTC_T *ar, A_BOOL asleep)
static void ar6k_send_asleep_event_to_app(struct ar6_softc *ar, bool asleep)
{
char buf[128];
union iwreq_data wrqu;
@ -82,17 +71,14 @@ static void ar6k_send_asleep_event_to_app(AR_SOFTC_T *ar, A_BOOL asleep)
wireless_send_event(ar->arNetDev, IWEVCUSTOM, &wrqu, buf);
}
static void ar6000_wow_resume(AR_SOFTC_T *ar)
static void ar6000_wow_resume(struct ar6_softc *ar)
{
if (ar->arWowState!= WLAN_WOW_STATE_NONE) {
A_UINT16 fg_start_period = (ar->scParams.fg_start_period==0) ? 1 : ar->scParams.fg_start_period;
A_UINT16 bg_period = (ar->scParams.bg_period==0) ? 60 : ar->scParams.bg_period;
WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {TRUE, FALSE};
u16 fg_start_period = (ar->scParams.fg_start_period==0) ? 1 : ar->scParams.fg_start_period;
u16 bg_period = (ar->scParams.bg_period==0) ? 60 : ar->scParams.bg_period;
WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {true, false};
ar->arWowState = WLAN_WOW_STATE_NONE;
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_timeout(&ar6k_wow_wake_lock, 3*HZ);
#endif
if (wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode)!=A_OK) {
if (wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode)!= 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup restore host awake\n"));
}
#if WOW_SET_SCAN_PARAMS
@ -113,10 +99,10 @@ static void ar6000_wow_resume(AR_SOFTC_T *ar)
#if WOW_ENABLE_MAX_INTERVAL /* we don't do it if the power consumption is already good enough. */
if (wmi_listeninterval_cmd(ar->arWmi, ar->arListenIntervalT, ar->arListenIntervalB) == A_OK) {
if (wmi_listeninterval_cmd(ar->arWmi, ar->arListenIntervalT, ar->arListenIntervalB) == 0) {
}
#endif
ar6k_send_asleep_event_to_app(ar, FALSE);
ar6k_send_asleep_event_to_app(ar, false);
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Resume WoW successfully\n"));
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("WoW does not invoked. skip resume"));
@ -124,7 +110,7 @@ static void ar6000_wow_resume(AR_SOFTC_T *ar)
ar->arWlanPowerState = WLAN_POWER_STATE_ON;
}
static void ar6000_wow_suspend(AR_SOFTC_T *ar)
static void ar6000_wow_suspend(struct ar6_softc *ar)
{
#define WOW_LIST_ID 1
if (ar->arNetworkType != AP_NETWORK) {
@ -135,12 +121,12 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
struct in_ifaddr **ifap = NULL;
struct in_ifaddr *ifa = NULL;
struct in_device *in_dev;
A_UINT8 macMask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
A_STATUS status;
u8 macMask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
int status;
WMI_ADD_WOW_PATTERN_CMD addWowCmd = { .filter = { 0 } };
WMI_DEL_WOW_PATTERN_CMD delWowCmd;
WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {FALSE, TRUE};
WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = TRUE,
WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode = {false, true};
WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = true,
.hostReqDelay = 500 };/*500 ms delay*/
if (ar->arWowState!= WLAN_WOW_STATE_NONE) {
@ -151,7 +137,7 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
ar6000_TxDataCleanup(ar); /* IMPORTANT, otherwise there will be 11mA after listen interval as 1000*/
#if WOW_ENABLE_MAX_INTERVAL /* we don't do it if the power consumption is already good enough. */
if (wmi_listeninterval_cmd(ar->arWmi, A_MAX_WOW_LISTEN_INTERVAL, 0) == A_OK) {
if (wmi_listeninterval_cmd(ar->arWmi, A_MAX_WOW_LISTEN_INTERVAL, 0) == 0) {
}
#endif
@ -169,7 +155,7 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
addWowCmd.filter_size = 6; /* MAC address */
addWowCmd.filter_offset = 0;
status = wmi_add_wow_pattern_cmd(ar->arWmi, &addWowCmd, ar->arNetDev->dev_addr, macMask, addWowCmd.filter_size);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to add WoW pattern\n"));
}
}
@ -186,7 +172,7 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
memset(&ipCmd, 0, sizeof(ipCmd));
ipCmd.ips[0] = ifa->ifa_local;
status = wmi_set_ip_cmd(ar->arWmi, &ipCmd);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup IP for ARP agent\n"));
}
}
@ -196,19 +182,19 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
#endif
status = wmi_set_wow_mode_cmd(ar->arWmi, &wowMode);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to enable wow mode\n"));
}
ar6k_send_asleep_event_to_app(ar, TRUE);
ar6k_send_asleep_event_to_app(ar, true);
status = wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to set host asleep\n"));
}
ar->arWowState = WLAN_WOW_STATE_SUSPENDING;
if (ar->arTxPending[ar->arControlEp]) {
A_UINT32 timeleft = wait_event_interruptible_timeout(arEvent,
u32 timeleft = wait_event_interruptible_timeout(arEvent,
ar->arTxPending[ar->arControlEp] == 0, wmitimeout * HZ);
if (!timeleft || signal_pending(current)) {
/* what can I do? wow resume at once */
@ -225,11 +211,11 @@ static void ar6000_wow_suspend(AR_SOFTC_T *ar)
}
}
A_STATUS ar6000_suspend_ev(void *context)
int ar6000_suspend_ev(void *context)
{
A_STATUS status = A_OK;
AR_SOFTC_T *ar = (AR_SOFTC_T *)context;
A_INT16 pmmode = ar->arSuspendConfig;
int status = 0;
struct ar6_softc *ar = (struct ar6_softc *)context;
s16 pmmode = ar->arSuspendConfig;
wow_not_connected:
switch (pmmode) {
case WLAN_SUSPEND_WOW:
@ -248,13 +234,13 @@ A_STATUS ar6000_suspend_ev(void *context)
case WLAN_SUSPEND_DEEP_SLEEP:
/* fall through */
default:
status = ar6000_update_wlan_pwr_state(ar, WLAN_DISABLED, TRUE);
status = ar6000_update_wlan_pwr_state(ar, WLAN_DISABLED, true);
if (ar->arWlanPowerState==WLAN_POWER_STATE_ON ||
ar->arWlanPowerState==WLAN_POWER_STATE_WOW) {
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("Strange suspend state for not wow mode %d", ar->arWlanPowerState));
}
AR_DEBUG_PRINTF(ATH_DEBUG_PM,("%s:Suspend for %d mode pwr %d status %d\n", __func__, pmmode, ar->arWlanPowerState, status));
status = (ar->arWlanPowerState == WLAN_POWER_STATE_CUT_PWR) ? A_OK : A_EBUSY;
status = (ar->arWlanPowerState == WLAN_POWER_STATE_CUT_PWR) ? 0 : A_EBUSY;
break;
}
@ -262,14 +248,11 @@ A_STATUS ar6000_suspend_ev(void *context)
return status;
}
A_STATUS ar6000_resume_ev(void *context)
int ar6000_resume_ev(void *context)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)context;
A_UINT16 powerState = ar->arWlanPowerState;
struct ar6_softc *ar = (struct ar6_softc *)context;
u16 powerState = ar->arWlanPowerState;
#ifdef CONFIG_HAS_WAKELOCK
wake_lock(&ar6k_suspend_wake_lock);
#endif
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: enter previous state %d wowState %d\n", __func__, powerState, ar->arWowState));
switch (powerState) {
case WLAN_POWER_STATE_WOW:
@ -278,7 +261,7 @@ A_STATUS ar6000_resume_ev(void *context)
case WLAN_POWER_STATE_CUT_PWR:
/* fall through */
case WLAN_POWER_STATE_DEEP_SLEEP:
ar6000_update_wlan_pwr_state(ar, WLAN_ENABLED, TRUE);
ar6000_update_wlan_pwr_state(ar, WLAN_ENABLED, true);
AR_DEBUG_PRINTF(ATH_DEBUG_PM,("%s:Resume for %d mode pwr %d\n", __func__, powerState, ar->arWlanPowerState));
break;
case WLAN_POWER_STATE_ON:
@ -287,13 +270,10 @@ A_STATUS ar6000_resume_ev(void *context)
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Strange SDIO bus power mode!!\n"));
break;
}
#ifdef CONFIG_HAS_WAKELOCK
wake_unlock(&ar6k_suspend_wake_lock);
#endif
return A_OK;
return 0;
}
void ar6000_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent)
void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent)
{
if (ar->arWowState!=WLAN_WOW_STATE_NONE) {
if (ar->arWowState==WLAN_WOW_STATE_SUSPENDING) {
@ -310,20 +290,20 @@ void ar6000_check_wow_status(AR_SOFTC_T *ar, struct sk_buff *skb, A_BOOL isEvent
}
}
A_STATUS ar6000_power_change_ev(void *context, A_UINT32 config)
int ar6000_power_change_ev(void *context, u32 config)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)context;
A_STATUS status = A_OK;
struct ar6_softc *ar = (struct ar6_softc *)context;
int status = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: power change event callback %d \n", __func__, config));
switch (config) {
case HIF_DEVICE_POWER_UP:
ar6000_restart_endpoint(ar->arNetDev);
status = A_OK;
status = 0;
break;
case HIF_DEVICE_POWER_DOWN:
case HIF_DEVICE_POWER_CUT:
status = A_OK;
status = 0;
break;
}
return status;
@ -362,10 +342,10 @@ static struct platform_driver ar6000_pm_device = {
};
#endif /* CONFIG_PM */
A_STATUS
int
ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
{
A_STATUS status = A_OK;
int status = 0;
HIF_DEVICE_POWER_CHANGE_TYPE config;
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: Cut power %d %d \n", __func__,state, ar->arWlanPowerState));
@ -395,18 +375,18 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
if (status == A_PENDING) {
#ifdef ANDROID_ENV
/* Wait for WMI ready event */
A_UINT32 timeleft = wait_event_interruptible_timeout(arEvent,
(ar->arWmiReady == TRUE), wmitimeout * HZ);
u32 timeleft = wait_event_interruptible_timeout(arEvent,
(ar->arWmiReady == true), wmitimeout * HZ);
if (!timeleft || signal_pending(current)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000 : Failed to get wmi ready \n"));
status = A_ERROR;
break;
}
#endif
status = A_OK;
} else if (status == A_OK) {
status = 0;
} else if (status == 0) {
ar6000_restart_endpoint(ar->arNetDev);
status = A_OK;
status = 0;
}
} else if (state == WLAN_DISABLED) {
@ -415,7 +395,7 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
if (ar->arWlanPowerState == WLAN_POWER_STATE_CUT_PWR) {
break;
}
ar6000_stop_endpoint(ar->arNetDev, TRUE, FALSE);
ar6000_stop_endpoint(ar->arNetDev, true, false);
config = HIF_DEVICE_POWER_CUT;
status = HIFConfigureDevice(ar->arHifDevice,
@ -432,10 +412,10 @@ ar6000_setup_cut_power_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
return status;
}
A_STATUS
int
ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
{
A_STATUS status = A_OK;
int status = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("%s: Deep sleep %d %d \n", __func__,state, ar->arWlanPowerState));
#ifdef CONFIG_PM
@ -445,7 +425,7 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
WMI_SET_HOST_SLEEP_MODE_CMD hostSleepMode;
if (state == WLAN_ENABLED) {
A_UINT16 fg_start_period;
u16 fg_start_period;
/* Not in deep sleep state.. exit */
if (ar->arWlanPowerState != WLAN_POWER_STATE_DEEP_SLEEP) {
@ -456,10 +436,10 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
}
fg_start_period = (ar->scParams.fg_start_period==0) ? 1 : ar->scParams.fg_start_period;
hostSleepMode.awake = TRUE;
hostSleepMode.asleep = FALSE;
hostSleepMode.awake = true;
hostSleepMode.asleep = false;
if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode)) != A_OK) {
if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode)) != 0) {
break;
}
@ -476,7 +456,7 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
ar->scParams.shortScanRatio,
ar->scParams.scanCtrlFlags,
ar->scParams.max_dfsch_act_time,
ar->scParams.maxact_scan_per_ssid)) != A_OK)
ar->scParams.maxact_scan_per_ssid)) != 0)
{
break;
}
@ -484,14 +464,14 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
if (ar->arNetworkType != AP_NETWORK)
{
if (ar->arSsidLen) {
if (ar6000_connect_to_ap(ar) != A_OK) {
if (ar6000_connect_to_ap(ar) != 0) {
/* no need to report error if connection failed */
break;
}
}
}
} else if (state == WLAN_DISABLED){
WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = FALSE };
WMI_SET_WOW_MODE_CMD wowMode = { .enable_wow = false };
/* Already in deep sleep state.. exit */
if (ar->arWlanPowerState != WLAN_POWER_STATE_ON) {
@ -505,7 +485,7 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
{
/* Disconnect from the AP and disable foreground scanning */
AR6000_SPIN_LOCK(&ar->arLock, 0);
if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) {
if (ar->arConnected == true || ar->arConnectPending == true) {
AR6000_SPIN_UNLOCK(&ar->arLock, 0);
wmi_disconnect_cmd(ar->arWmi);
} else {
@ -515,12 +495,12 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
ar->scan_triggered = 0;
if ((status=wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0, 0, 0)) != A_OK) {
if ((status=wmi_scanparams_cmd(ar->arWmi, 0xFFFF, 0, 0, 0, 0, 0, 0, 0, 0, 0)) != 0) {
break;
}
/* make sure we disable wow for deep sleep */
if ((status=wmi_set_wow_mode_cmd(ar->arWmi, &wowMode))!=A_OK)
if ((status=wmi_set_wow_mode_cmd(ar->arWmi, &wowMode))!= 0)
{
break;
}
@ -530,13 +510,13 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
wmi_powermode_cmd(ar->arWmi, REC_POWER);
#endif
hostSleepMode.awake = FALSE;
hostSleepMode.asleep = TRUE;
if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode))!=A_OK) {
hostSleepMode.awake = false;
hostSleepMode.asleep = true;
if ((status=wmi_set_host_sleep_mode_cmd(ar->arWmi, &hostSleepMode))!= 0) {
break;
}
if (ar->arTxPending[ar->arControlEp]) {
A_UINT32 timeleft = wait_event_interruptible_timeout(arEvent,
u32 timeleft = wait_event_interruptible_timeout(arEvent,
ar->arTxPending[ar->arControlEp] == 0, wmitimeout * HZ);
if (!timeleft || signal_pending(current)) {
status = A_ERROR;
@ -549,22 +529,22 @@ ar6000_setup_deep_sleep_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
}
} while (0);
if (status!=A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to enter/exit deep sleep %d\n", state));
}
return status;
}
A_STATUS
ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BOOL pmEvent)
int
ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, bool pmEvent)
{
A_STATUS status = A_OK;
A_UINT16 powerState, oldPowerState;
int status = 0;
u16 powerState, oldPowerState;
AR6000_WLAN_STATE oldstate = ar->arWlanState;
A_BOOL wlanOff = ar->arWlanOff;
bool wlanOff = ar->arWlanOff;
#ifdef CONFIG_PM
A_BOOL btOff = ar->arBTOff;
bool btOff = ar->arBTOff;
#endif /* CONFIG_PM */
if ((state!=WLAN_DISABLED && state!=WLAN_ENABLED)) {
@ -598,7 +578,7 @@ ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BO
}
#ifdef CONFIG_PM
else if (pmEvent && wlanOff) {
A_BOOL allowCutPwr = ((!ar->arBTSharing) || btOff);
bool allowCutPwr = ((!ar->arBTSharing) || btOff);
if ((powerState==WLAN_POWER_STATE_CUT_PWR) && (!allowCutPwr)) {
/* Come out of cut power */
ar6000_setup_cut_power_state(ar, WLAN_ENABLED);
@ -611,10 +591,10 @@ ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BO
powerState = WLAN_POWER_STATE_DEEP_SLEEP;
#ifdef CONFIG_PM
if (pmEvent) { /* disable due to suspend */
A_BOOL suspendCutPwr = (ar->arSuspendConfig == WLAN_SUSPEND_CUT_PWR ||
bool suspendCutPwr = (ar->arSuspendConfig == WLAN_SUSPEND_CUT_PWR ||
(ar->arSuspendConfig == WLAN_SUSPEND_WOW &&
ar->arWow2Config==WLAN_SUSPEND_CUT_PWR));
A_BOOL suspendCutIfBtOff = ((ar->arSuspendConfig ==
bool suspendCutIfBtOff = ((ar->arSuspendConfig ==
WLAN_SUSPEND_CUT_PWR_IF_BT_OFF ||
(ar->arSuspendConfig == WLAN_SUSPEND_WOW &&
ar->arWow2Config==WLAN_SUSPEND_CUT_PWR_IF_BT_OFF)) &&
@ -648,10 +628,10 @@ ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BO
}
if (status!=A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Fail to setup WLAN state %d\n", ar->arWlanState));
ar->arWlanState = oldstate;
} else if (status == A_OK) {
} else if (status == 0) {
WMI_REPORT_SLEEP_STATE_EVENT wmiSleepEvent, *pSleepEvent = NULL;
if ((ar->arWlanPowerState == WLAN_POWER_STATE_ON) && (oldPowerState != WLAN_POWER_STATE_ON)) {
wmiSleepEvent.sleepState = WMI_REPORT_SLEEP_STATUS_IS_AWAKE;
@ -662,7 +642,7 @@ ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BO
}
if (pSleepEvent) {
AR_DEBUG_PRINTF(ATH_DEBUG_PM, ("SENT WLAN Sleep Event %d\n", wmiSleepEvent.sleepState));
ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (A_UINT8*)pSleepEvent,
ar6000_send_event_to_app(ar, WMI_REPORT_SLEEP_STATE_EVENTID, (u8 *)pSleepEvent,
sizeof(WMI_REPORT_SLEEP_STATE_EVENTID));
}
}
@ -670,33 +650,33 @@ ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BO
return status;
}
A_STATUS
ar6000_set_bt_hw_state(struct ar6_softc *ar, A_UINT32 enable)
int
ar6000_set_bt_hw_state(struct ar6_softc *ar, u32 enable)
{
#ifdef CONFIG_PM
A_BOOL off = (enable == 0);
A_STATUS status;
bool off = (enable == 0);
int status;
if (ar->arBTOff == off) {
return A_OK;
return 0;
}
ar->arBTOff = off;
status = ar6000_update_wlan_pwr_state(ar, ar->arWlanOff ? WLAN_DISABLED : WLAN_ENABLED, FALSE);
status = ar6000_update_wlan_pwr_state(ar, ar->arWlanOff ? WLAN_DISABLED : WLAN_ENABLED, false);
return status;
#else
return A_OK;
return 0;
#endif
}
A_STATUS
int
ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state)
{
A_STATUS status;
A_BOOL off = (state == WLAN_DISABLED);
int status;
bool off = (state == WLAN_DISABLED);
if (ar->arWlanOff == off) {
return A_OK;
return 0;
}
ar->arWlanOff = off;
status = ar6000_update_wlan_pwr_state(ar, state, FALSE);
status = ar6000_update_wlan_pwr_state(ar, state, false);
return status;
}
@ -704,10 +684,6 @@ void ar6000_pm_init()
{
A_REGISTER_MODULE_DEBUG_INFO(pm);
#ifdef CONFIG_PM
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&ar6k_suspend_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_suspend");
wake_lock_init(&ar6k_wow_wake_lock, WAKE_LOCK_SUSPEND, "ar6k_wow");
#endif
/*
* Register ar6000_pm_device into system.
* We should also add platform_device into the first item of array
@ -723,9 +699,5 @@ void ar6000_pm_exit()
{
#ifdef CONFIG_PM
platform_driver_unregister(&ar6000_pm_device);
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_destroy(&ar6k_suspend_wake_lock);
wake_lock_destroy(&ar6k_wow_wake_lock);
#endif
#endif /* CONFIG_PM */
}

View File

@ -26,9 +26,9 @@
#ifdef HTC_RAW_INTERFACE
static void
ar6000_htc_raw_read_cb(void *Context, HTC_PACKET *pPacket)
ar6000_htc_raw_read_cb(void *Context, struct htc_packet *pPacket)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)Context;
struct ar6_softc *ar = (struct ar6_softc *)Context;
raw_htc_buffer *busy;
HTC_RAW_STREAM_ID streamID;
AR_RAW_HTC_T *arRaw = ar->arRawHtc;
@ -55,12 +55,12 @@ ar6000_htc_raw_read_cb(void *Context, HTC_PACKET *pPacket)
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Unable to down the semaphore\n"));
}
A_ASSERT((pPacket->Status != A_OK) ||
A_ASSERT((pPacket->Status != 0) ||
(pPacket->pBuffer == (busy->data + HTC_HEADER_LEN)));
busy->length = pPacket->ActualLength + HTC_HEADER_LEN;
busy->currPtr = HTC_HEADER_LEN;
arRaw->read_buffer_available[streamID] = TRUE;
arRaw->read_buffer_available[streamID] = true;
//AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("raw read cb: 0x%X 0x%X \n", busy->currPtr,busy->length);
up(&arRaw->raw_htc_read_sem[streamID]);
@ -70,9 +70,9 @@ ar6000_htc_raw_read_cb(void *Context, HTC_PACKET *pPacket)
}
static void
ar6000_htc_raw_write_cb(void *Context, HTC_PACKET *pPacket)
ar6000_htc_raw_write_cb(void *Context, struct htc_packet *pPacket)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)Context;
struct ar6_softc *ar = (struct ar6_softc *)Context;
raw_htc_buffer *free;
HTC_RAW_STREAM_ID streamID;
AR_RAW_HTC_T *arRaw = ar->arRawHtc;
@ -102,7 +102,7 @@ ar6000_htc_raw_write_cb(void *Context, HTC_PACKET *pPacket)
A_ASSERT(pPacket->pBuffer == (free->data + HTC_HEADER_LEN));
free->length = 0;
arRaw->write_buffer_available[streamID] = TRUE;
arRaw->write_buffer_available[streamID] = true;
up(&arRaw->raw_htc_write_sem[streamID]);
/* Signal the waiting process */
@ -111,21 +111,21 @@ ar6000_htc_raw_write_cb(void *Context, HTC_PACKET *pPacket)
}
/* connect to a service */
static A_STATUS ar6000_connect_raw_service(AR_SOFTC_T *ar,
static int ar6000_connect_raw_service(struct ar6_softc *ar,
HTC_RAW_STREAM_ID StreamID)
{
A_STATUS status;
HTC_SERVICE_CONNECT_RESP response;
A_UINT8 streamNo;
HTC_SERVICE_CONNECT_REQ connect;
int status;
struct htc_service_connect_resp response;
u8 streamNo;
struct htc_service_connect_req connect;
do {
A_MEMZERO(&connect,sizeof(connect));
/* pass the stream ID as meta data to the RAW streams service */
streamNo = (A_UINT8)StreamID;
streamNo = (u8)StreamID;
connect.pMetaData = &streamNo;
connect.MetaDataLength = sizeof(A_UINT8);
connect.MetaDataLength = sizeof(u8);
/* these fields are the same for all endpoints */
connect.EpCallbacks.pContext = ar;
connect.EpCallbacks.EpTxComplete = ar6000_htc_raw_write_cb;
@ -147,10 +147,10 @@ static A_STATUS ar6000_connect_raw_service(AR_SOFTC_T *ar,
&connect,
&response);
if (A_FAILED(status)) {
if (status) {
if (response.ConnectRespCode == HTC_SERVICE_NO_MORE_EP) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTC RAW , No more streams allowed \n"));
status = A_OK;
status = 0;
}
break;
}
@ -161,14 +161,14 @@ static A_STATUS ar6000_connect_raw_service(AR_SOFTC_T *ar,
AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("HTC RAW : stream ID: %d, endpoint: %d\n",
StreamID, arRawStream2EndpointID(ar,StreamID)));
} while (FALSE);
} while (false);
return status;
}
int ar6000_htc_raw_open(AR_SOFTC_T *ar)
int ar6000_htc_raw_open(struct ar6_softc *ar)
{
A_STATUS status;
int status;
int streamID, endPt, count2;
raw_htc_buffer *buffer;
HTC_SERVICE_ID servicepriority;
@ -187,7 +187,7 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)
/* wait for target */
status = HTCWaitTarget(ar->arHtcTarget);
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("HTCWaitTarget failed (%d)\n", status));
return -ENODEV;
}
@ -206,7 +206,7 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)
/* try to connect to the raw service */
status = ar6000_connect_raw_service(ar,streamID);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -228,7 +228,7 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)
arRawStream2EndpointID(ar,streamID));
/* Queue buffers to HTC for receive */
if ((status = HTCAddReceivePkt(ar->arHtcTarget, &buffer->HTCPacket)) != A_OK)
if ((status = HTCAddReceivePkt(ar->arHtcTarget, &buffer->HTCPacket)) != 0)
{
BMIInit();
return -EIO;
@ -241,11 +241,11 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)
memset(buffer, 0, sizeof(raw_htc_buffer));
}
arRaw->read_buffer_available[streamID] = FALSE;
arRaw->write_buffer_available[streamID] = TRUE;
arRaw->read_buffer_available[streamID] = false;
arRaw->write_buffer_available[streamID] = true;
}
if (A_FAILED(status)) {
if (status) {
return -EIO;
}
@ -262,23 +262,23 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)
1);
/* Start the HTC component */
if ((status = HTCStart(ar->arHtcTarget)) != A_OK) {
if ((status = HTCStart(ar->arHtcTarget)) != 0) {
BMIInit();
return -EIO;
}
(ar)->arRawIfInit = TRUE;
(ar)->arRawIfInit = true;
return 0;
}
int ar6000_htc_raw_close(AR_SOFTC_T *ar)
int ar6000_htc_raw_close(struct ar6_softc *ar)
{
A_PRINTF("ar6000_htc_raw_close called \n");
HTCStop(ar->arHtcTarget);
/* reset the device */
ar6000_reset_device(ar->arHifDevice, ar->arTargetType, TRUE, FALSE);
ar6000_reset_device(ar->arHifDevice, ar->arTargetType, true, false);
/* Initialize the BMI component */
BMIInit();
@ -286,7 +286,7 @@ int ar6000_htc_raw_close(AR_SOFTC_T *ar)
}
raw_htc_buffer *
get_filled_buffer(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID)
get_filled_buffer(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID)
{
int count;
raw_htc_buffer *busy;
@ -300,15 +300,15 @@ get_filled_buffer(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID)
}
}
if (busy->length) {
arRaw->read_buffer_available[StreamID] = TRUE;
arRaw->read_buffer_available[StreamID] = true;
} else {
arRaw->read_buffer_available[StreamID] = FALSE;
arRaw->read_buffer_available[StreamID] = false;
}
return busy;
}
ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID,
ssize_t ar6000_htc_raw_read(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID,
char __user *buffer, size_t length)
{
int readPtr;
@ -361,14 +361,14 @@ ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID,
//AR_DEBUG_PRINTF(ATH_DEBUG_HTC_RAW,("raw read ioctl: ep for packet:%d \n", busy->HTCPacket.Endpoint));
HTCAddReceivePkt(ar->arHtcTarget, &busy->HTCPacket);
}
arRaw->read_buffer_available[StreamID] = FALSE;
arRaw->read_buffer_available[StreamID] = false;
up(&arRaw->raw_htc_read_sem[StreamID]);
return length;
}
static raw_htc_buffer *
get_free_buffer(AR_SOFTC_T *ar, HTC_ENDPOINT_ID StreamID)
get_free_buffer(struct ar6_softc *ar, HTC_ENDPOINT_ID StreamID)
{
int count;
raw_htc_buffer *free;
@ -382,15 +382,15 @@ get_free_buffer(AR_SOFTC_T *ar, HTC_ENDPOINT_ID StreamID)
}
}
if (!free->length) {
arRaw->write_buffer_available[StreamID] = TRUE;
arRaw->write_buffer_available[StreamID] = true;
} else {
arRaw->write_buffer_available[StreamID] = FALSE;
arRaw->write_buffer_available[StreamID] = false;
}
return free;
}
ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID,
ssize_t ar6000_htc_raw_write(struct ar6_softc *ar, HTC_RAW_STREAM_ID StreamID,
char __user *buffer, size_t length)
{
int writePtr;
@ -447,7 +447,7 @@ ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar, HTC_RAW_STREAM_ID StreamID,
HTCSendPkt(ar->arHtcTarget,&free->HTCPacket);
arRaw->write_buffer_available[StreamID] = FALSE;
arRaw->write_buffer_available[StreamID] = false;
up(&arRaw->raw_htc_write_sem[StreamID]);
return length;

View File

@ -49,7 +49,7 @@ typedef struct ar6k_hci_pal_info_s{
#define HCI_NORMAL_MODE (1)
#define HCI_REGISTERED (1<<1)
struct hci_dev *hdev; /* BT Stack HCI dev */
AR_SOFTC_T *ar;
struct ar6_softc *ar;
}ar6k_hci_pal_info_t;
@ -120,9 +120,9 @@ static int btpal_send_frame(struct sk_buff *skb)
struct hci_dev *hdev = (struct hci_dev *)skb->dev;
HCI_TRANSPORT_PACKET_TYPE type;
ar6k_hci_pal_info_t *pHciPalInfo;
A_STATUS status = A_OK;
int status = 0;
struct sk_buff *txSkb = NULL;
AR_SOFTC_T *ar;
struct ar6_softc *ar;
if (!hdev) {
PRIN_LOG("HCI PAL: btpal_send_frame - no device\n");
@ -157,7 +157,7 @@ static int btpal_send_frame(struct sk_buff *skb)
kfree_skb(skb);
return 0;
default:
A_ASSERT(FALSE);
A_ASSERT(false);
kfree_skb(skb);
return 0;
}
@ -178,13 +178,13 @@ static int btpal_send_frame(struct sk_buff *skb)
{
PRIN_LOG("HCI command");
if (ar->arWmiReady == FALSE)
if (ar->arWmiReady == false)
{
PRIN_LOG("WMI not ready ");
break;
}
if (wmi_send_hci_cmd(ar->arWmi, skb->data, skb->len) != A_OK)
if (wmi_send_hci_cmd(ar->arWmi, skb->data, skb->len) != 0)
{
PRIN_LOG("send hci cmd error");
break;
@ -195,7 +195,7 @@ static int btpal_send_frame(struct sk_buff *skb)
void *osbuf;
PRIN_LOG("ACL data");
if (ar->arWmiReady == FALSE)
if (ar->arWmiReady == false)
{
PRIN_LOG("WMI not ready");
break;
@ -215,12 +215,12 @@ static int btpal_send_frame(struct sk_buff *skb)
bt_cb(txSkb)->pkt_type = bt_cb(skb)->pkt_type;
txSkb->dev = (void *)pHciPalInfo->hdev;
skb_reserve(txSkb, TX_PACKET_RSV_OFFSET + WMI_MAX_TX_META_SZ + sizeof(WMI_DATA_HDR));
A_MEMCPY(txSkb->data, skb->data, skb->len);
memcpy(txSkb->data, skb->data, skb->len);
skb_put(txSkb,skb->len);
/* Add WMI packet type */
osbuf = (void *)txSkb;
if (wmi_data_hdr_add(ar->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != A_OK) {
if (wmi_data_hdr_add(ar->arWmi, osbuf, DATA_MSGTYPE, 0, WMI_DATA_HDR_DATA_TYPE_ACL,0,NULL) != 0) {
PRIN_LOG("XIOCTL_ACL_DATA - wmi_data_hdr_add failed\n");
} else {
/* Send data buffer over HTC */
@ -229,7 +229,7 @@ static int btpal_send_frame(struct sk_buff *skb)
}
txSkb = NULL;
}
} while (FALSE);
} while (false);
if (txSkb != NULL) {
PRIN_LOG("Free skb");
@ -260,22 +260,20 @@ static void bt_cleanup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
}
}
if (pHciPalInfo->hdev != NULL) {
kfree(pHciPalInfo->hdev);
pHciPalInfo->hdev = NULL;
}
kfree(pHciPalInfo->hdev);
pHciPalInfo->hdev = NULL;
}
/*********************************************************
* Allocate HCI device and store in PAL private info structure.
*********************************************************/
static A_STATUS bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
static int bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
{
A_STATUS status = A_OK;
int status = 0;
struct hci_dev *pHciDev = NULL;
if (!setupbtdev) {
return A_OK;
return 0;
}
do {
@ -302,9 +300,9 @@ static A_STATUS bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
PRIN_LOG("Normal mode enabled");
bt_set_bit(pHciPalInfo->ulFlags, HCI_NORMAL_MODE);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
bt_cleanup_hci_pal(pHciPalInfo);
}
return status;
@ -315,7 +313,7 @@ static A_STATUS bt_setup_hci_pal(ar6k_hci_pal_info_t *pHciPalInfo)
*********************************************/
void ar6k_cleanup_hci_pal(void *ar_p)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar_p;
struct ar6_softc *ar = (struct ar6_softc *)ar_p;
ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)ar->hcipal_info;
if (pHciPalInfo != NULL) {
@ -328,22 +326,22 @@ void ar6k_cleanup_hci_pal(void *ar_p)
/****************************
* Register HCI device
****************************/
static A_BOOL ar6k_pal_transport_ready(void *pHciPal)
static bool ar6k_pal_transport_ready(void *pHciPal)
{
ar6k_hci_pal_info_t *pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal;
PRIN_LOG("HCI device transport ready");
if(pHciPalInfo == NULL)
return FALSE;
return false;
if (hci_register_dev(pHciPalInfo->hdev) < 0) {
PRIN_LOG("Can't register HCI device");
hci_free_dev(pHciPalInfo->hdev);
return FALSE;
return false;
}
PRIN_LOG("HCI device registered");
pHciPalInfo->ulFlags |= HCI_REGISTERED;
return TRUE;
return true;
}
/**************************************************
@ -351,12 +349,12 @@ static A_BOOL ar6k_pal_transport_ready(void *pHciPal)
* packet is received. Pass the packet to bluetooth
* stack via hci_recv_frame.
**************************************************/
A_BOOL ar6k_pal_recv_pkt(void *pHciPal, void *osbuf)
bool ar6k_pal_recv_pkt(void *pHciPal, void *osbuf)
{
struct sk_buff *skb = (struct sk_buff *)osbuf;
ar6k_hci_pal_info_t *pHciPalInfo;
A_BOOL success = FALSE;
A_UINT8 btType = 0;
bool success = false;
u8 btType = 0;
pHciPalInfo = (ar6k_hci_pal_info_t *)pHciPal;
do {
@ -391,8 +389,8 @@ A_BOOL ar6k_pal_recv_pkt(void *pHciPal, void *osbuf)
PRIN_LOG("HCI PAL: Indicated RCV of type:%d, Length:%d \n",HCI_EVENT_PKT, skb->len);
}
PRIN_LOG("hci recv success");
success = TRUE;
}while(FALSE);
success = true;
}while(false);
return success;
}
@ -402,12 +400,12 @@ A_BOOL ar6k_pal_recv_pkt(void *pHciPal, void *osbuf)
* Registers a HCI device.
* Registers packet receive callback function with ar6k
**********************************************************/
A_STATUS ar6k_setup_hci_pal(void *ar_p)
int ar6k_setup_hci_pal(void *ar_p)
{
A_STATUS status = A_OK;
int status = 0;
ar6k_hci_pal_info_t *pHciPalInfo;
ar6k_pal_config_t ar6k_pal_config;
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar_p;
struct ar6_softc *ar = (struct ar6_softc *)ar_p;
do {
@ -423,7 +421,7 @@ A_STATUS ar6k_setup_hci_pal(void *ar_p)
pHciPalInfo->ar = ar;
status = bt_setup_hci_pal(pHciPalInfo);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -435,17 +433,17 @@ A_STATUS ar6k_setup_hci_pal(void *ar_p)
ar6k_pal_config.fpar6k_pal_recv_pkt = ar6k_pal_recv_pkt;
register_pal_cb(&ar6k_pal_config);
ar6k_pal_transport_ready(ar->hcipal_info);
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
ar6k_cleanup_hci_pal(ar);
}
return status;
}
#else /* AR6K_ENABLE_HCI_PAL */
A_STATUS ar6k_setup_hci_pal(void *ar_p)
int ar6k_setup_hci_pal(void *ar_p)
{
return A_OK;
return 0;
}
void ar6k_cleanup_hci_pal(void *ar_p)
{
@ -457,15 +455,15 @@ void ar6k_cleanup_hci_pal(void *ar_p)
* Register init and callback function with ar6k
* when PAL driver is a separate kernel module.
****************************************************/
A_STATUS ar6k_register_hci_pal(HCI_TRANSPORT_CALLBACKS *hciTransCallbacks);
int ar6k_register_hci_pal(struct hci_transport_callbacks *hciTransCallbacks);
static int __init pal_init_module(void)
{
HCI_TRANSPORT_CALLBACKS hciTransCallbacks;
struct hci_transport_callbacks hciTransCallbacks;
hciTransCallbacks.setupTransport = ar6k_setup_hci_pal;
hciTransCallbacks.cleanupTransport = ar6k_cleanup_hci_pal;
if(ar6k_register_hci_pal(&hciTransCallbacks) != A_OK)
if(ar6k_register_hci_pal(&hciTransCallbacks) != 0)
return -ENODEV;
return 0;

View File

@ -136,7 +136,7 @@ ieee80211_supported_band ar6k_band_5ghz = {
};
static int
ar6k_set_wpa_version(AR_SOFTC_T *ar, enum nl80211_wpa_versions wpa_version)
ar6k_set_wpa_version(struct ar6_softc *ar, enum nl80211_wpa_versions wpa_version)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: %u\n", __func__, wpa_version));
@ -153,11 +153,11 @@ ar6k_set_wpa_version(AR_SOFTC_T *ar, enum nl80211_wpa_versions wpa_version)
return -ENOTSUPP;
}
return A_OK;
return 0;
}
static int
ar6k_set_auth_type(AR_SOFTC_T *ar, enum nl80211_auth_type auth_type)
ar6k_set_auth_type(struct ar6_softc *ar, enum nl80211_auth_type auth_type)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, auth_type));
@ -179,15 +179,15 @@ ar6k_set_auth_type(AR_SOFTC_T *ar, enum nl80211_auth_type auth_type)
return -ENOTSUPP;
}
return A_OK;
return 0;
}
static int
ar6k_set_cipher(AR_SOFTC_T *ar, A_UINT32 cipher, A_BOOL ucast)
ar6k_set_cipher(struct ar6_softc *ar, u32 cipher, bool ucast)
{
A_UINT8 *ar_cipher = ucast ? &ar->arPairwiseCrypto :
u8 *ar_cipher = ucast ? &ar->arPairwiseCrypto :
&ar->arGroupCrypto;
A_UINT8 *ar_cipher_len = ucast ? &ar->arPairwiseCryptoLen :
u8 *ar_cipher_len = ucast ? &ar->arPairwiseCryptoLen :
&ar->arGroupCryptoLen;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
@ -221,11 +221,11 @@ ar6k_set_cipher(AR_SOFTC_T *ar, A_UINT32 cipher, A_BOOL ucast)
return -ENOTSUPP;
}
return A_OK;
return 0;
}
static void
ar6k_set_key_mgmt(AR_SOFTC_T *ar, A_UINT32 key_mgmt)
ar6k_set_key_mgmt(struct ar6_softc *ar, u32 key_mgmt)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, key_mgmt));
@ -244,12 +244,13 @@ static int
ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_connect_params *sme)
{
AR_SOFTC_T *ar = ar6k_priv(dev);
A_STATUS status;
struct ar6_softc *ar = ar6k_priv(dev);
int status;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
ar->smeState = SME_CONNECTING;
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready yet\n", __func__));
return -EIO;
}
@ -269,7 +270,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
return -EINVAL;
}
if(ar->arSkipScan == TRUE &&
if(ar->arSkipScan == true &&
((sme->channel && sme->channel->center_freq == 0) ||
(sme->bssid && !sme->bssid[0] && !sme->bssid[1] && !sme->bssid[2] &&
!sme->bssid[3] && !sme->bssid[4] && !sme->bssid[5])))
@ -302,28 +303,28 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
}
}
if(ar->arConnected == TRUE &&
if(ar->arConnected == true &&
ar->arSsidLen == sme->ssid_len &&
!A_MEMCMP(ar->arSsid, sme->ssid, ar->arSsidLen)) {
reconnect_flag = TRUE;
!memcmp(ar->arSsid, sme->ssid, ar->arSsidLen)) {
reconnect_flag = true;
status = wmi_reconnect_cmd(ar->arWmi,
ar->arReqBssid,
ar->arChannelHint);
up(&ar->arSem);
if (status != A_OK) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_reconnect_cmd failed\n", __func__));
return -EIO;
}
return 0;
} else if(ar->arSsidLen == sme->ssid_len &&
!A_MEMCMP(ar->arSsid, sme->ssid, ar->arSsidLen)) {
wmi_disconnect_cmd(ar->arWmi);
!memcmp(ar->arSsid, sme->ssid, ar->arSsidLen)) {
ar6000_disconnect(ar);
}
A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
ar->arSsidLen = sme->ssid_len;
A_MEMCPY(ar->arSsid, sme->ssid, sme->ssid_len);
memcpy(ar->arSsid, sme->ssid, sme->ssid_len);
if(sme->channel){
ar->arChannelHint = sme->channel->center_freq;
@ -331,8 +332,8 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
if(sme->bssid){
if(A_MEMCMP(&sme->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) {
A_MEMCPY(ar->arReqBssid, sme->bssid, sizeof(ar->arReqBssid));
if(memcmp(&sme->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) {
memcpy(ar->arReqBssid, sme->bssid, sizeof(ar->arReqBssid));
}
}
@ -364,7 +365,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
key = &ar->keys[sme->key_idx];
key->key_len = sme->key_len;
A_MEMCPY(key->key, sme->key, key->key_len);
memcpy(key->key, sme->key, key->key_len);
key->cipher = ar->arPairwiseCrypto;
ar->arDefTxKeyIndex = sme->key_idx;
@ -378,7 +379,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
}
if (!ar->arUserBssFilter) {
if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != A_OK) {
if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__));
up(&ar->arSem);
return -EIO;
@ -410,7 +411,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
ar->arSsidLen = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Invalid request\n", __func__));
return -ENOENT;
} else if (status != A_OK) {
} else if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_connect_cmd failed\n", __func__));
return -EIO;
}
@ -422,37 +423,37 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
}
ar->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD;
ar->arConnectPending = TRUE;
ar->arConnectPending = true;
return 0;
}
void
ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
A_UINT8 *bssid, A_UINT16 listenInterval,
A_UINT16 beaconInterval,NETWORK_TYPE networkType,
A_UINT8 beaconIeLen, A_UINT8 assocReqLen,
A_UINT8 assocRespLen, A_UINT8 *assocInfo)
ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel,
u8 *bssid, u16 listenInterval,
u16 beaconInterval,NETWORK_TYPE networkType,
u8 beaconIeLen, u8 assocReqLen,
u8 assocRespLen, u8 *assocInfo)
{
A_UINT16 size = 0;
A_UINT16 capability = 0;
u16 size = 0;
u16 capability = 0;
struct cfg80211_bss *bss = NULL;
struct ieee80211_mgmt *mgmt = NULL;
struct ieee80211_channel *ibss_channel = NULL;
s32 signal = 50 * 100;
A_UINT8 ie_buf_len = 0;
u8 ie_buf_len = 0;
unsigned char ie_buf[256];
unsigned char *ptr_ie_buf = ie_buf;
unsigned char *ieeemgmtbuf = NULL;
A_UINT8 source_mac[ATH_MAC_LEN];
u8 source_mac[ATH_MAC_LEN];
A_UINT8 assocReqIeOffset = sizeof(A_UINT16) + /* capinfo*/
sizeof(A_UINT16); /* listen interval */
A_UINT8 assocRespIeOffset = sizeof(A_UINT16) + /* capinfo*/
sizeof(A_UINT16) + /* status Code */
sizeof(A_UINT16); /* associd */
A_UINT8 *assocReqIe = assocInfo + beaconIeLen + assocReqIeOffset;
A_UINT8 *assocRespIe = assocInfo + beaconIeLen + assocReqLen + assocRespIeOffset;
u8 assocReqIeOffset = sizeof(u16) + /* capinfo*/
sizeof(u16); /* listen interval */
u8 assocRespIeOffset = sizeof(u16) + /* capinfo*/
sizeof(u16) + /* status Code */
sizeof(u16); /* associd */
u8 *assocReqIe = assocInfo + beaconIeLen + assocReqIeOffset;
u8 *assocRespIe = assocInfo + beaconIeLen + assocReqLen + assocRespIeOffset;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
@ -492,7 +493,7 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
if(ptr_ie_buf) {
*ptr_ie_buf++ = WLAN_EID_SSID;
*ptr_ie_buf++ = ar->arSsidLen;
A_MEMCPY(ptr_ie_buf, ar->arSsid, ar->arSsidLen);
memcpy(ptr_ie_buf, ar->arSsid, ar->arSsidLen);
ptr_ie_buf +=ar->arSsidLen;
*ptr_ie_buf++ = WLAN_EID_IBSS_PARAMS;
@ -510,11 +511,11 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
if(WEP_CRYPT == ar->arPairwiseCrypto) {
capability |= IEEE80211_CAPINFO_PRIVACY;
}
A_MEMCPY(source_mac, ar->arNetDev->dev_addr, ATH_MAC_LEN);
memcpy(source_mac, ar->arNetDev->dev_addr, ATH_MAC_LEN);
ptr_ie_buf = ie_buf;
} else {
capability = *(A_UINT16 *)(&assocInfo[beaconIeLen]);
A_MEMCPY(source_mac, bssid, ATH_MAC_LEN);
capability = *(u16 *)(&assocInfo[beaconIeLen]);
memcpy(source_mac, bssid, ATH_MAC_LEN);
ptr_ie_buf = assocReqIe;
ie_buf_len = assocReqLen;
}
@ -533,12 +534,12 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
A_MEMZERO(ieeemgmtbuf, size);
mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf;
mgmt->frame_control = (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN);
A_MEMCPY(mgmt->sa, source_mac, ATH_MAC_LEN);
A_MEMCPY(mgmt->bssid, bssid, ATH_MAC_LEN);
memcpy(mgmt->da, bcast_mac, ATH_MAC_LEN);
memcpy(mgmt->sa, source_mac, ATH_MAC_LEN);
memcpy(mgmt->bssid, bssid, ATH_MAC_LEN);
mgmt->u.beacon.beacon_int = beaconInterval;
mgmt->u.beacon.capab_info = capability;
A_MEMCPY(mgmt->u.beacon.variable, ptr_ie_buf, ie_buf_len);
memcpy(mgmt->u.beacon.variable, ptr_ie_buf, ie_buf_len);
ibss_channel = ieee80211_get_channel(ar->wdev->wiphy, (int)channel);
@ -560,8 +561,9 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
return;
}
if (FALSE == ar->arConnected) {
if (false == ar->arConnected) {
/* inform connect result to cfg80211 */
ar->smeState = SME_DISCONNECTED;
cfg80211_connect_result(ar->arNetDev, bssid,
assocReqIe, assocReqLen,
assocRespIe, assocRespLen,
@ -577,13 +579,13 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
static int
ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
A_UINT16 reason_code)
u16 reason_code)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason_code));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -604,11 +606,11 @@ ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
}
reconnect_flag = 0;
wmi_disconnect_cmd(ar->arWmi);
ar6000_disconnect(ar);
A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
ar->arSsidLen = 0;
if (ar->arSkipScan == FALSE) {
if (ar->arSkipScan == false) {
A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
}
@ -618,9 +620,9 @@ ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
}
void
ar6k_cfg80211_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason,
A_UINT8 *bssid, A_UINT8 assocRespLen,
A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus)
ar6k_cfg80211_disconnect_event(struct ar6_softc *ar, u8 reason,
u8 *bssid, u8 assocRespLen,
u8 *assocInfo, u16 protocolReasonStatus)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason));
@ -644,18 +646,28 @@ ar6k_cfg80211_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason,
}
}
if(FALSE == ar->arConnected) {
if(true == ar->arConnectPending) {
if(NO_NETWORK_AVAIL == reason) {
/* connect cmd failed */
cfg80211_connect_result(ar->arNetDev, bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
wmi_disconnect_cmd(ar->arWmi);
} else if (reason == DISCONNECT_CMD) {
/* connection loss due to disconnect cmd or low rssi */
ar->arConnectPending = false;
if (ar->smeState == SME_CONNECTING) {
cfg80211_connect_result(ar->arNetDev, bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
} else {
cfg80211_disconnected(ar->arNetDev, reason, NULL, 0, GFP_KERNEL);
}
ar->smeState = SME_DISCONNECTED;
}
} else {
/* connection loss due to disconnect cmd or low rssi */
cfg80211_disconnected(ar->arNetDev, reason, NULL, 0, GFP_KERNEL);
if (reason != DISCONNECT_CMD) {
wmi_disconnect_cmd(ar->arWmi);
}
}
}
@ -663,7 +675,7 @@ void
ar6k_cfg80211_scan_node(void *arg, bss_t *ni)
{
struct wiphy *wiphy = (struct wiphy *)arg;
A_UINT16 size;
u16 size;
unsigned char *ieeemgmtbuf = NULL;
struct ieee80211_mgmt *mgmt;
struct ieee80211_channel *channel;
@ -700,10 +712,10 @@ ar6k_cfg80211_scan_node(void *arg, bss_t *ni)
cfg80211 needs it, for time being just filling the da, sa and bssid fields alone.
*/
mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf;
A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN);
A_MEMCPY(mgmt->sa, ni->ni_macaddr, ATH_MAC_LEN);
A_MEMCPY(mgmt->bssid, ni->ni_macaddr, ATH_MAC_LEN);
A_MEMCPY(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u),
memcpy(mgmt->da, bcast_mac, ATH_MAC_LEN);
memcpy(mgmt->sa, ni->ni_macaddr, ATH_MAC_LEN);
memcpy(mgmt->bssid, ni->ni_macaddr, ATH_MAC_LEN);
memcpy(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u),
ni->ni_buf, ni->ni_framelen);
freq = cie->ie_chan;
@ -724,13 +736,13 @@ static int
ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
int ret = 0;
A_BOOL forceFgScan = FALSE;
u32 forceFgScan = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -743,7 +755,7 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
if (!ar->arUserBssFilter) {
if (wmi_bssfilter_cmd(ar->arWmi,
(ar->arConnected ? ALL_BUT_BSS_FILTER : ALL_BSS_FILTER),
0) != A_OK) {
0) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__));
return -EIO;
}
@ -751,25 +763,25 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
if(request->n_ssids &&
request->ssids[0].ssid_len) {
A_UINT8 i;
u8 i;
if(request->n_ssids > MAX_PROBED_SSID_INDEX) {
request->n_ssids = MAX_PROBED_SSID_INDEX;
if(request->n_ssids > (MAX_PROBED_SSID_INDEX - 1)) {
request->n_ssids = MAX_PROBED_SSID_INDEX - 1;
}
for (i = 0; i < request->n_ssids; i++) {
wmi_probedSsid_cmd(ar->arWmi, i, SPECIFIC_SSID_FLAG,
wmi_probedSsid_cmd(ar->arWmi, i+1, SPECIFIC_SSID_FLAG,
request->ssids[i].ssid_len,
request->ssids[i].ssid);
}
}
if(ar->arConnected) {
forceFgScan = TRUE;
forceFgScan = 1;
}
if(wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, forceFgScan, FALSE, \
0, 0, 0, NULL) != A_OK) {
if(wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, forceFgScan, false, \
0, 0, 0, NULL) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_startscan_cmd failed\n", __func__));
ret = -EIO;
}
@ -780,7 +792,7 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
}
void
ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status)
ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status));
@ -791,14 +803,14 @@ ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status)
wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy);
cfg80211_scan_done(ar->scan_request,
(status & A_ECANCELED) ? true : false);
((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false);
if(ar->scan_request->n_ssids &&
ar->scan_request->ssids[0].ssid_len) {
A_UINT8 i;
u8 i;
for (i = 0; i < ar->scan_request->n_ssids; i++) {
wmi_probedSsid_cmd(ar->arWmi, i, DISABLE_SSID_FLAG,
wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG,
0, NULL);
}
}
@ -808,18 +820,18 @@ ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status)
static int
ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr,
u8 key_index, bool pairwise, const u8 *mac_addr,
struct key_params *params)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
struct ar_key *key = NULL;
A_UINT8 key_usage;
A_UINT8 key_type;
A_STATUS status = 0;
u8 key_usage;
u8 key_type;
int status = 0;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s:\n", __func__));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -850,9 +862,9 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
return -EINVAL;
key->key_len = params->key_len;
A_MEMCPY(key->key, params->key, key->key_len);
memcpy(key->key, params->key, key->key_len);
key->seq_len = params->seq_len;
A_MEMCPY(key->seq, params->seq, key->seq_len);
memcpy(key->seq, params->seq, key->seq_len);
key->cipher = params->cipher;
}
@ -889,10 +901,10 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
ar->arDefTxKeyIndex = key_index;
status = wmi_addKey_cmd(ar->arWmi, ar->arDefTxKeyIndex, key_type, key_usage,
key->key_len, key->seq, key->key, KEY_OP_INIT_VAL,
(A_UINT8*)mac_addr, SYNC_BOTH_WMIFLAG);
(u8 *)mac_addr, SYNC_BOTH_WMIFLAG);
if(status != A_OK) {
if (status) {
return -EIO;
}
@ -901,13 +913,13 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
static int
ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr)
u8 key_index, bool pairwise, const u8 *mac_addr)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -936,17 +948,17 @@ ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
static int
ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr,
u8 key_index, bool pairwise, const u8 *mac_addr,
void *cookie,
void (*callback)(void *cookie, struct key_params*))
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
struct ar_key *key = NULL;
struct key_params params;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -978,15 +990,16 @@ ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
static int
ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev,
A_UINT8 key_index)
u8 key_index, bool unicast, bool multicast)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
struct ar_key *key = NULL;
A_STATUS status = A_OK;
int status = 0;
u8 key_usage;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1011,11 +1024,16 @@ ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev,
ar->arDefTxKeyIndex = key_index;
key = &ar->keys[ar->arDefTxKeyIndex];
key_usage = GROUP_USAGE;
if (WEP_CRYPT == ar->arPairwiseCrypto) {
key_usage |= TX_USAGE;
}
status = wmi_addKey_cmd(ar->arWmi, ar->arDefTxKeyIndex,
ar->arPairwiseCrypto, GROUP_USAGE | TX_USAGE,
ar->arPairwiseCrypto, key_usage,
key->key_len, key->seq, key->key, KEY_OP_INIT_VAL,
NULL, SYNC_BOTH_WMIFLAG);
if (status != A_OK) {
if (status) {
return -EIO;
}
@ -1024,13 +1042,13 @@ ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev,
static int
ar6k_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev,
A_UINT8 key_index)
u8 key_index)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1045,7 +1063,7 @@ ar6k_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev,
}
void
ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast)
ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast)
{
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: keyid %d, ismcast %d\n", __func__, keyid, ismcast));
@ -1056,13 +1074,13 @@ ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast)
}
static int
ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed)
ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy);
struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: changed 0x%x\n", __func__, changed));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1073,7 +1091,7 @@ ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed)
}
if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
if (wmi_set_rts_cmd(ar->arWmi,wiphy->rts_threshold) != A_OK){
if (wmi_set_rts_cmd(ar->arWmi,wiphy->rts_threshold) != 0){
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_set_rts_cmd failed\n", __func__));
return -EIO;
}
@ -1084,7 +1102,7 @@ ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed)
static int
ar6k_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
const A_UINT8 *peer,
const u8 *peer,
const struct cfg80211_bitrate_mask *mask)
{
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Setting rates: Not supported\n"));
@ -1095,12 +1113,12 @@ ar6k_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev,
static int
ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting type, int dbm)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy);
A_UINT8 ar_dbm;
struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy);
u8 ar_dbm;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x, dbm %d\n", __func__, type, dbm));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1110,13 +1128,13 @@ ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting typ
return -EIO;
}
ar->arTxPwrSet = FALSE;
ar->arTxPwrSet = false;
switch(type) {
case NL80211_TX_POWER_AUTOMATIC:
return 0;
case NL80211_TX_POWER_LIMITED:
ar->arTxPwr = ar_dbm = dbm;
ar->arTxPwrSet = TRUE;
ar->arTxPwrSet = true;
break;
default:
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x not supported\n", __func__, type));
@ -1131,11 +1149,11 @@ ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting typ
static int
ar6k_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy);
struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1145,10 +1163,10 @@ ar6k_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm)
return -EIO;
}
if((ar->arConnected == TRUE)) {
if((ar->arConnected == true)) {
ar->arTxPwr = 0;
if(wmi_get_txPwr_cmd(ar->arWmi) != A_OK) {
if(wmi_get_txPwr_cmd(ar->arWmi) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_get_txPwr_cmd failed\n", __func__));
return -EIO;
}
@ -1170,12 +1188,12 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy,
struct net_device *dev,
bool pmgmt, int timeout)
{
AR_SOFTC_T *ar = ar6k_priv(dev);
struct ar6_softc *ar = ar6k_priv(dev);
WMI_POWER_MODE_CMD pwrMode;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: pmgmt %d, timeout %d\n", __func__, pmgmt, timeout));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1193,7 +1211,7 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy,
pwrMode.powerMode = REC_POWER;
}
if(wmi_powermode_cmd(ar->arWmi, pwrMode.powerMode) != A_OK) {
if(wmi_powermode_cmd(ar->arWmi, pwrMode.powerMode) != 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_powermode_cmd failed\n", __func__));
return -EIO;
}
@ -1201,7 +1219,7 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy,
return 0;
}
static int
static struct net_device *
ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name,
enum nl80211_iftype type, u32 *flags,
struct vif_params *params)
@ -1212,7 +1230,7 @@ ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name,
/* Multiple virtual interface is not supported.
* The default interface supports STA and IBSS type
*/
return -EOPNOTSUPP;
return ERR_PTR(-EOPNOTSUPP);
}
static int
@ -1232,12 +1250,12 @@ ar6k_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
enum nl80211_iftype type, u32 *flags,
struct vif_params *params)
{
AR_SOFTC_T *ar = ar6k_priv(ndev);
struct ar6_softc *ar = ar6k_priv(ndev);
struct wireless_dev *wdev = ar->wdev;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type %u\n", __func__, type));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1268,12 +1286,12 @@ static int
ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_ibss_params *ibss_param)
{
AR_SOFTC_T *ar = ar6k_priv(dev);
A_STATUS status;
struct ar6_softc *ar = ar6k_priv(dev);
int status;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1289,7 +1307,7 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
}
ar->arSsidLen = ibss_param->ssid_len;
A_MEMCPY(ar->arSsid, ibss_param->ssid, ar->arSsidLen);
memcpy(ar->arSsid, ibss_param->ssid, ar->arSsidLen);
if(ibss_param->channel) {
ar->arChannelHint = ibss_param->channel->center_freq;
@ -1303,8 +1321,8 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid));
if(ibss_param->bssid) {
if(A_MEMCMP(&ibss_param->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) {
A_MEMCPY(ar->arReqBssid, ibss_param->bssid, sizeof(ar->arReqBssid));
if(memcmp(&ibss_param->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) {
memcpy(ar->arReqBssid, ibss_param->bssid, sizeof(ar->arReqBssid));
}
}
@ -1335,6 +1353,7 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
ar->arSsidLen, ar->arSsid,
ar->arReqBssid, ar->arChannelHint,
ar->arConnectCtrlFlags);
ar->arConnectPending = true;
return 0;
}
@ -1342,11 +1361,11 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
static int
ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
{
AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev);
struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
if(ar->arWmiReady == FALSE) {
if(ar->arWmiReady == false) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__));
return -EIO;
}
@ -1356,7 +1375,7 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
return -EIO;
}
wmi_disconnect_cmd(ar->arWmi);
ar6000_disconnect(ar);
A_MEMZERO(ar->arSsid, sizeof(ar->arSsid));
ar->arSsidLen = 0;
@ -1365,7 +1384,7 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
static const
A_UINT32 cipher_suites[] = {
u32 cipher_suites[] = {
WLAN_CIPHER_SUITE_WEP40,
WLAN_CIPHER_SUITE_WEP104,
WLAN_CIPHER_SUITE_TKIP,
@ -1410,7 +1429,7 @@ ar6k_cfg80211_init(struct device *dev)
}
/* create a new wiphy for use with cfg80211 */
wdev->wiphy = wiphy_new(&ar6k_cfg80211_ops, sizeof(AR_SOFTC_T));
wdev->wiphy = wiphy_new(&ar6k_cfg80211_ops, sizeof(struct ar6_softc));
if(!wdev->wiphy) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: Couldn't allocate wiphy device\n", __func__));
@ -1444,7 +1463,7 @@ ar6k_cfg80211_init(struct device *dev)
}
void
ar6k_cfg80211_deinit(AR_SOFTC_T *ar)
ar6k_cfg80211_deinit(struct ar6_softc *ar)
{
struct wireless_dev *wdev = ar->wdev;

View File

@ -53,9 +53,9 @@ char *p_mac = NULL;
// static variables
//
static A_UCHAR eeprom_data[EEPROM_SZ];
static A_UINT32 sys_sleep_reg;
static HIF_DEVICE *p_bmi_device;
static u8 eeprom_data[EEPROM_SZ];
static u32 sys_sleep_reg;
static struct hif_device *p_bmi_device;
//
// Functions
@ -63,7 +63,7 @@ static HIF_DEVICE *p_bmi_device;
/* soft mac */
static int
wmic_ether_aton(const char *orig, A_UINT8 *eth)
wmic_ether_aton(const char *orig, u8 *eth)
{
const char *bufp;
int i;
@ -103,23 +103,23 @@ wmic_ether_aton(const char *orig, A_UINT8 *eth)
}
static void
update_mac(unsigned char* eeprom, int size, unsigned char* macaddr)
update_mac(unsigned char *eeprom, int size, unsigned char *macaddr)
{
int i;
A_UINT16* ptr = (A_UINT16*)(eeprom+4);
A_UINT16 checksum = 0;
u16 *ptr = (u16 *)(eeprom+4);
u16 checksum = 0;
memcpy(eeprom+10,macaddr,6);
*ptr = 0;
ptr = (A_UINT16*)eeprom;
ptr = (u16 *)eeprom;
for (i=0; i<size; i+=2) {
checksum ^= *ptr++;
}
checksum = ~checksum;
ptr = (A_UINT16*)(eeprom+4);
ptr = (u16 *)(eeprom+4);
*ptr = checksum;
return;
}
@ -127,30 +127,30 @@ update_mac(unsigned char* eeprom, int size, unsigned char* macaddr)
/* Read a Target register and return its value. */
inline void
BMI_read_reg(A_UINT32 address, A_UINT32 *pvalue)
BMI_read_reg(u32 address, u32 *pvalue)
{
BMIReadSOCRegister(p_bmi_device, address, pvalue);
}
/* Write a value to a Target register. */
inline void
BMI_write_reg(A_UINT32 address, A_UINT32 value)
BMI_write_reg(u32 address, u32 value)
{
BMIWriteSOCRegister(p_bmi_device, address, value);
}
/* Read Target memory word and return its value. */
inline void
BMI_read_mem(A_UINT32 address, A_UINT32 *pvalue)
BMI_read_mem(u32 address, u32 *pvalue)
{
BMIReadMemory(p_bmi_device, address, (A_UCHAR*)(pvalue), 4);
BMIReadMemory(p_bmi_device, address, (u8*)(pvalue), 4);
}
/* Write a word to a Target memory. */
inline void
BMI_write_mem(A_UINT32 address, A_UINT8 *p_data, A_UINT32 sz)
BMI_write_mem(u32 address, u8 *p_data, u32 sz)
{
BMIWriteMemory(p_bmi_device, address, (A_UCHAR*)(p_data), sz);
BMIWriteMemory(p_bmi_device, address, (u8*)(p_data), sz);
}
/*
@ -158,9 +158,9 @@ BMI_write_mem(A_UINT32 address, A_UINT8 *p_data, A_UINT32 sz)
* so we can access the EEPROM.
*/
static void
enable_SI(HIF_DEVICE *p_device)
enable_SI(struct hif_device *p_device)
{
A_UINT32 regval;
u32 regval;
printk("%s\n", __FUNCTION__);
@ -200,7 +200,7 @@ enable_SI(HIF_DEVICE *p_device)
static void
disable_SI(void)
{
A_UINT32 regval;
u32 regval;
printk("%s\n", __FUNCTION__);
@ -218,7 +218,7 @@ disable_SI(void)
static void
request_8byte_read(int offset)
{
A_UINT32 regval;
u32 regval;
// printk("%s: request_8byte_read from offset 0x%x\n", __FUNCTION__, offset);
@ -241,9 +241,9 @@ request_8byte_read(int offset)
* writing values from Target TX_DATA registers.
*/
static void
request_4byte_write(int offset, A_UINT32 data)
request_4byte_write(int offset, u32 data)
{
A_UINT32 regval;
u32 regval;
printk("%s: request_4byte_write (0x%x) to offset 0x%x\n", __FUNCTION__, data, offset);
@ -266,10 +266,10 @@ request_4byte_write(int offset, A_UINT32 data)
* Check whether or not an EEPROM request that was started
* earlier has completed yet.
*/
static A_BOOL
static bool
request_in_progress(void)
{
A_UINT32 regval;
u32 regval;
/* Wait for DONE_INT in SI_CS */
BMI_read_reg(SI_BASE_ADDRESS+SI_CS_OFFSET, &regval);
@ -288,8 +288,8 @@ request_in_progress(void)
static void eeprom_type_detect(void)
{
A_UINT32 regval;
A_UINT8 i = 0;
u32 regval;
u8 i = 0;
request_8byte_read(0x100);
/* Wait for DONE_INT in SI_CS */
@ -310,7 +310,7 @@ static void eeprom_type_detect(void)
* and return them to the caller.
*/
inline void
read_8byte_results(A_UINT32 *data)
read_8byte_results(u32 *data)
{
/* Read SI_RX_DATA0 and SI_RX_DATA1 */
BMI_read_reg(SI_BASE_ADDRESS+SI_RX_DATA0_OFFSET, &data[0]);
@ -339,7 +339,7 @@ wait_for_eeprom_completion(void)
* waits for it to complete, and returns the result.
*/
static void
fetch_8bytes(int offset, A_UINT32 *data)
fetch_8bytes(int offset, u32 *data)
{
request_8byte_read(offset);
wait_for_eeprom_completion();
@ -354,17 +354,17 @@ fetch_8bytes(int offset, A_UINT32 *data)
* and waits for it to complete.
*/
inline void
commit_4bytes(int offset, A_UINT32 data)
commit_4bytes(int offset, u32 data)
{
request_4byte_write(offset, data);
wait_for_eeprom_completion();
}
/* ATHENV */
#ifdef ANDROID_ENV
void eeprom_ar6000_transfer(HIF_DEVICE *device, char *fake_file, char *p_mac)
void eeprom_ar6000_transfer(struct hif_device *device, char *fake_file, char *p_mac)
{
A_UINT32 first_word;
A_UINT32 board_data_addr;
u32 first_word;
u32 board_data_addr;
int i;
printk("%s: Enter\n", __FUNCTION__);
@ -437,17 +437,17 @@ void eeprom_ar6000_transfer(HIF_DEVICE *device, char *fake_file, char *p_mac)
* Fetch EEPROM_SZ Bytes of Board Data, 8 bytes at a time.
*/
fetch_8bytes(0, (A_UINT32 *)(&eeprom_data[0]));
fetch_8bytes(0, (u32 *)(&eeprom_data[0]));
/* Check the first word of EEPROM for validity */
first_word = *((A_UINT32 *)eeprom_data);
first_word = *((u32 *)eeprom_data);
if ((first_word == 0) || (first_word == 0xffffffff)) {
printk("Did not find EEPROM with valid Board Data.\n");
}
for (i=8; i<EEPROM_SZ; i+=8) {
fetch_8bytes(i, (A_UINT32 *)(&eeprom_data[i]));
fetch_8bytes(i, (u32 *)(&eeprom_data[i]));
}
}
@ -558,13 +558,13 @@ void eeprom_ar6000_transfer(HIF_DEVICE *device, char *fake_file, char *p_mac)
/* soft mac */
/* Write EEPROM data to Target RAM */
BMI_write_mem(board_data_addr, ((A_UINT8 *)eeprom_data), EEPROM_SZ);
BMI_write_mem(board_data_addr, ((u8 *)eeprom_data), EEPROM_SZ);
/* Record the fact that Board Data IS initialized */
{
A_UINT32 one = 1;
u32 one = 1;
BMI_write_mem(HOST_INTEREST_ITEM_ADDRESS(hi_board_data_initialized),
(A_UINT8 *)&one, sizeof(A_UINT32));
(u8 *)&one, sizeof(u32));
}
disable_SI();

View File

@ -36,22 +36,22 @@
#include "AR6002/hw4.0/hw/uart_reg.h"
#include "AR6002/hw4.0/hw/rtc_wlan_reg.h"
HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo);
HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, struct hci_transport_config_info *pInfo);
void (*_HCI_TransportDetach)(HCI_TRANSPORT_HANDLE HciTrans);
A_STATUS (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue);
A_STATUS (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous);
int (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet_queue *pQueue);
int (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet *pPacket, bool Synchronous);
void (*_HCI_TransportStop)(HCI_TRANSPORT_HANDLE HciTrans);
A_STATUS (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans);
A_STATUS (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
A_STATUS (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans,
HTC_PACKET *pPacket,
int (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans);
int (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
int (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans,
struct htc_packet *pPacket,
int MaxPollMS);
A_STATUS (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud);
A_STATUS (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
int (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, u32 Baud);
int (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
extern HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks;
extern struct hci_transport_callbacks ar6kHciTransCallbacks;
A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallbacks)
int ar6000_register_hci_transport(struct hci_transport_callbacks *hciTransCallbacks)
{
ar6kHciTransCallbacks = *hciTransCallbacks;
@ -66,41 +66,41 @@ A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallback
_HCI_TransportSetBaudRate = HCI_TransportSetBaudRate;
_HCI_TransportEnablePowerMgmt = HCI_TransportEnablePowerMgmt;
return A_OK;
return 0;
}
A_STATUS
ar6000_get_hif_dev(HIF_DEVICE *device, void *config)
int
ar6000_get_hif_dev(struct hif_device *device, void *config)
{
A_STATUS status;
int status;
status = HIFConfigureDevice(device,
HIF_DEVICE_GET_OS_DEVICE,
(HIF_DEVICE_OS_DEVICE_INFO *)config,
sizeof(HIF_DEVICE_OS_DEVICE_INFO));
(struct hif_device_os_device_info *)config,
sizeof(struct hif_device_os_device_info));
return status;
}
A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice,
A_UINT32 scale,
A_UINT32 step)
int ar6000_set_uart_config(struct hif_device *hifDevice,
u32 scale,
u32 step)
{
A_UINT32 regAddress;
A_UINT32 regVal;
A_STATUS status;
u32 regAddress;
u32 regVal;
int status;
regAddress = WLAN_UART_BASE_ADDRESS | UART_CLKDIV_ADDRESS;
regVal = ((A_UINT32)scale << 16) | step;
regVal = ((u32)scale << 16) | step;
/* change the HCI UART scale/step values through the diagnostic window */
status = ar6000_WriteRegDiag(hifDevice, &regAddress, &regVal);
return status;
}
A_STATUS ar6000_get_core_clock_config(HIF_DEVICE *hifDevice, A_UINT32 *data)
int ar6000_get_core_clock_config(struct hif_device *hifDevice, u32 *data)
{
A_UINT32 regAddress;
A_STATUS status;
u32 regAddress;
int status;
regAddress = WLAN_RTC_BASE_ADDRESS | WLAN_CPU_CLOCK_ADDRESS;
/* read CPU clock settings*/

View File

@ -73,21 +73,21 @@ extern unsigned int hciuartscale;
extern unsigned int hciuartstep;
#endif /* EXPORT_HCI_BRIDGE_INTERFACE */
typedef struct {
struct ar6k_hci_bridge_info {
void *pHCIDev; /* HCI bridge device */
HCI_TRANSPORT_PROPERTIES HCIProps; /* HCI bridge props */
struct hci_transport_properties HCIProps; /* HCI bridge props */
struct hci_dev *pBtStackHCIDev; /* BT Stack HCI dev */
A_BOOL HciNormalMode; /* Actual HCI mode enabled (non-TEST)*/
A_BOOL HciRegistered; /* HCI device registered with stack */
HTC_PACKET_QUEUE HTCPacketStructHead;
A_UINT8 *pHTCStructAlloc;
bool HciNormalMode; /* Actual HCI mode enabled (non-TEST)*/
bool HciRegistered; /* HCI device registered with stack */
struct htc_packet_queue HTCPacketStructHead;
u8 *pHTCStructAlloc;
spinlock_t BridgeLock;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
HCI_TRANSPORT_MISC_HANDLES HCITransHdl;
struct hci_transport_misc_handles HCITransHdl;
#else
AR_SOFTC_T *ar;
struct ar6_softc *ar;
#endif /* EXPORT_HCI_BRIDGE_INTERFACE */
} AR6K_HCI_BRIDGE_INFO;
};
#define MAX_ACL_RECV_BUFS 16
#define MAX_EVT_RECV_BUFS 8
@ -97,39 +97,39 @@ typedef struct {
#define TX_PACKET_RSV_OFFSET 32
#define NUM_HTC_PACKET_STRUCTS ((MAX_ACL_RECV_BUFS + MAX_EVT_RECV_BUFS + MAX_HCI_WRITE_QUEUE_DEPTH) * 2)
#define HCI_GET_OP_CODE(p) (((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0]))
#define HCI_GET_OP_CODE(p) (((u16)((p)[1])) << 8) | ((u16)((p)[0]))
extern unsigned int setupbtdev;
AR3K_CONFIG_INFO ar3kconfig;
struct ar3k_config_info ar3kconfig;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
AR6K_HCI_BRIDGE_INFO *g_pHcidevInfo;
struct ar6k_hci_bridge_info *g_pHcidevInfo;
#endif
static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo);
static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo);
static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo);
static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
static int bt_setup_hci(struct ar6k_hci_bridge_info *pHcidevInfo);
static void bt_cleanup_hci(struct ar6k_hci_bridge_info *pHcidevInfo);
static int bt_register_hci(struct ar6k_hci_bridge_info *pHcidevInfo);
static bool bt_indicate_recv(struct ar6k_hci_bridge_info *pHcidevInfo,
HCI_TRANSPORT_PACKET_TYPE Type,
struct sk_buff *skb);
static struct sk_buff *bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length);
static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb);
static struct sk_buff *bt_alloc_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, int Length);
static void bt_free_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, struct sk_buff *skb);
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
A_STATUS ar6000_setup_hci(void *ar);
int ar6000_setup_hci(void *ar);
void ar6000_cleanup_hci(void *ar);
A_STATUS hci_test_send(void *ar, struct sk_buff *skb);
int hci_test_send(void *ar, struct sk_buff *skb);
#else
A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar);
void ar6000_cleanup_hci(AR_SOFTC_T *ar);
int ar6000_setup_hci(struct ar6_softc *ar);
void ar6000_cleanup_hci(struct ar6_softc *ar);
/* HCI bridge testing */
A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb);
int hci_test_send(struct ar6_softc *ar, struct sk_buff *skb);
#endif /* EXPORT_HCI_BRIDGE_INTERFACE */
#define LOCK_BRIDGE(dev) spin_lock_bh(&(dev)->BridgeLock)
#define UNLOCK_BRIDGE(dev) spin_unlock_bh(&(dev)->BridgeLock)
static inline void FreeBtOsBuf(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, void *osbuf)
static inline void FreeBtOsBuf(struct ar6k_hci_bridge_info *pHcidevInfo, void *osbuf)
{
if (pHcidevInfo->HciNormalMode) {
bt_free_buffer(pHcidevInfo, (struct sk_buff *)osbuf);
@ -139,16 +139,16 @@ static inline void FreeBtOsBuf(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, void *osbuf)
}
}
static void FreeHTCStruct(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, HTC_PACKET *pPacket)
static void FreeHTCStruct(struct ar6k_hci_bridge_info *pHcidevInfo, struct htc_packet *pPacket)
{
LOCK_BRIDGE(pHcidevInfo);
HTC_PACKET_ENQUEUE(&pHcidevInfo->HTCPacketStructHead,pPacket);
UNLOCK_BRIDGE(pHcidevInfo);
}
static HTC_PACKET * AllocHTCStruct(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static struct htc_packet * AllocHTCStruct(struct ar6k_hci_bridge_info *pHcidevInfo)
{
HTC_PACKET *pPacket = NULL;
struct htc_packet *pPacket = NULL;
LOCK_BRIDGE(pHcidevInfo);
pPacket = HTC_PACKET_DEQUEUE(&pHcidevInfo->HTCPacketStructHead);
UNLOCK_BRIDGE(pHcidevInfo);
@ -157,14 +157,14 @@ static HTC_PACKET * AllocHTCStruct(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
#define BLOCK_ROUND_UP_PWR2(x, align) (((int) (x) + ((align)-1)) & ~((align)-1))
static void RefillRecvBuffers(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
static void RefillRecvBuffers(struct ar6k_hci_bridge_info *pHcidevInfo,
HCI_TRANSPORT_PACKET_TYPE Type,
int NumBuffers)
{
int length, i;
void *osBuf = NULL;
HTC_PACKET_QUEUE queue;
HTC_PACKET *pPacket;
struct htc_packet_queue queue;
struct htc_packet *pPacket;
INIT_HTC_PACKET_QUEUE(&queue);
@ -215,18 +215,18 @@ static void RefillRecvBuffers(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
#define HOST_INTEREST_ITEM_ADDRESS(ar, item) \
(((ar)->arTargetType == TARGET_TYPE_AR6002) ? AR6002_HOST_INTEREST_ITEM_ADDRESS(item) : \
(((ar)->arTargetType == TARGET_TYPE_AR6003) ? AR6003_HOST_INTEREST_ITEM_ADDRESS(item) : 0))
static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
HCI_TRANSPORT_PROPERTIES *pProps,
static int ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
struct hci_transport_properties *pProps,
void *pContext)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
A_STATUS status;
A_UINT32 address, hci_uart_pwr_mgmt_params;
// AR3K_CONFIG_INFO ar3kconfig;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
int status;
u32 address, hci_uart_pwr_mgmt_params;
// struct ar3k_config_info ar3kconfig;
pHcidevInfo->pHCIDev = HCIHandle;
A_MEMCPY(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps));
memcpy(&pHcidevInfo->HCIProps,pProps,sizeof(*pProps));
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE,("HCI ready (hci:0x%lX, headroom:%d, tailroom:%d blockpad:%d) \n",
(unsigned long)HCIHandle,
@ -248,7 +248,7 @@ static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
/* start transport */
status = HCI_TransportStart(pHcidevInfo->pHCIDev);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -270,7 +270,7 @@ static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
ar3kconfig.pHCIDev = pHcidevInfo->pHCIDev;
ar3kconfig.pHCIProps = &pHcidevInfo->HCIProps;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
ar3kconfig.pHIFDevice = (HIF_DEVICE *)(pHcidevInfo->HCITransHdl.hifDevice);
ar3kconfig.pHIFDevice = (struct hif_device *)(pHcidevInfo->HCITransHdl.hifDevice);
#else
ar3kconfig.pHIFDevice = pHcidevInfo->ar->arHifDevice;
#endif
@ -285,8 +285,8 @@ static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
if ((hciuartscale != 0) || (hciuartstep != 0)) {
/* user wants to tune HCI bridge UART scale/step values */
ar3kconfig.AR6KScale = (A_UINT16)hciuartscale;
ar3kconfig.AR6KStep = (A_UINT16)hciuartstep;
ar3kconfig.AR6KScale = (u16)hciuartscale;
ar3kconfig.AR6KStep = (u16)hciuartstep;
ar3kconfig.Flags |= AR3K_CONFIG_FLAG_SET_AR6K_SCALE_STEP;
}
@ -294,7 +294,7 @@ static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
address = TARG_VTOP(pHcidevInfo->ar->arTargetType,
HOST_INTEREST_ITEM_ADDRESS(pHcidevInfo->ar, hi_hci_uart_pwr_mgmt_params));
status = ar6000_ReadRegDiag(pHcidevInfo->ar->arHifDevice, &address, &hci_uart_pwr_mgmt_params);
if (A_OK == status) {
if (0 == status) {
ar3kconfig.PwrMgmtEnabled = (hci_uart_pwr_mgmt_params & 0x1);
ar3kconfig.IdleTimeout = (hci_uart_pwr_mgmt_params & 0xFFFF0000) >> 16;
ar3kconfig.WakeupTimeout = (hci_uart_pwr_mgmt_params & 0xFF00) >> 8;
@ -304,28 +304,28 @@ static A_STATUS ar6000_hci_transport_ready(HCI_TRANSPORT_HANDLE HCIHandle,
/* configure the AR3K device */
memcpy(ar3kconfig.bdaddr,pHcidevInfo->ar->bdaddr,6);
status = AR3KConfigure(&ar3kconfig);
if (A_FAILED(status)) {
if (status) {
break;
}
/* Make sure both AR6K and AR3K have power management enabled */
if (ar3kconfig.PwrMgmtEnabled) {
status = HCI_TransportEnablePowerMgmt(pHcidevInfo->pHCIDev, TRUE);
if (A_FAILED(status)) {
status = HCI_TransportEnablePowerMgmt(pHcidevInfo->pHCIDev, true);
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to enable TLPM for AR6K! \n"));
}
}
status = bt_register_hci(pHcidevInfo);
} while (FALSE);
} while (false);
return status;
}
static void ar6000_hci_transport_failure(void *pContext, A_STATUS Status)
static void ar6000_hci_transport_failure(void *pContext, int Status)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: transport failure! \n"));
@ -336,7 +336,7 @@ static void ar6000_hci_transport_failure(void *pContext, A_STATUS Status)
static void ar6000_hci_transport_removed(void *pContext)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: transport removed. \n"));
@ -347,14 +347,14 @@ static void ar6000_hci_transport_removed(void *pContext)
pHcidevInfo->pHCIDev = NULL;
}
static void ar6000_hci_send_complete(void *pContext, HTC_PACKET *pPacket)
static void ar6000_hci_send_complete(void *pContext, struct htc_packet *pPacket)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
void *osbuf = pPacket->pPktContext;
A_ASSERT(osbuf != NULL);
A_ASSERT(pHcidevInfo != NULL);
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
if ((pPacket->Status != A_ECANCELED) && (pPacket->Status != A_NO_RESOURCE)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: Send Packet Failed: %d \n",pPacket->Status));
}
@ -365,9 +365,9 @@ static void ar6000_hci_send_complete(void *pContext, HTC_PACKET *pPacket)
}
static void ar6000_hci_pkt_recv(void *pContext, HTC_PACKET *pPacket)
static void ar6000_hci_pkt_recv(void *pContext, struct htc_packet *pPacket)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
struct sk_buff *skb;
A_ASSERT(pHcidevInfo != NULL);
@ -376,7 +376,7 @@ static void ar6000_hci_pkt_recv(void *pContext, HTC_PACKET *pPacket)
do {
if (A_FAILED(pPacket->Status)) {
if (pPacket->Status) {
break;
}
@ -419,7 +419,7 @@ static void ar6000_hci_pkt_recv(void *pContext, HTC_PACKET *pPacket)
skb = NULL;
}
} while (FALSE);
} while (false);
FreeHTCStruct(pHcidevInfo,pPacket);
@ -432,7 +432,7 @@ static void ar6000_hci_pkt_recv(void *pContext, HTC_PACKET *pPacket)
static void ar6000_hci_pkt_refill(void *pContext, HCI_TRANSPORT_PACKET_TYPE Type, int BuffersAvailable)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
int refillCount;
if (Type == HCI_ACL_TYPE) {
@ -447,9 +447,9 @@ static void ar6000_hci_pkt_refill(void *pContext, HCI_TRANSPORT_PACKET_TYPE Typ
}
static HCI_SEND_FULL_ACTION ar6000_hci_pkt_send_full(void *pContext, HTC_PACKET *pPacket)
static HCI_SEND_FULL_ACTION ar6000_hci_pkt_send_full(void *pContext, struct htc_packet *pPacket)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)pContext;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)pContext;
HCI_SEND_FULL_ACTION action = HCI_SEND_FULL_KEEP;
if (!pHcidevInfo->HciNormalMode) {
@ -464,31 +464,31 @@ static HCI_SEND_FULL_ACTION ar6000_hci_pkt_send_full(void *pContext, HTC_PACKET
}
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
A_STATUS ar6000_setup_hci(void *ar)
int ar6000_setup_hci(void *ar)
#else
A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
int ar6000_setup_hci(struct ar6_softc *ar)
#endif
{
HCI_TRANSPORT_CONFIG_INFO config;
A_STATUS status = A_OK;
struct hci_transport_config_info config;
int status = 0;
int i;
HTC_PACKET *pPacket;
AR6K_HCI_BRIDGE_INFO *pHcidevInfo;
struct htc_packet *pPacket;
struct ar6k_hci_bridge_info *pHcidevInfo;
do {
pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)A_MALLOC(sizeof(AR6K_HCI_BRIDGE_INFO));
pHcidevInfo = (struct ar6k_hci_bridge_info *)A_MALLOC(sizeof(struct ar6k_hci_bridge_info));
if (NULL == pHcidevInfo) {
status = A_NO_MEMORY;
break;
}
A_MEMZERO(pHcidevInfo, sizeof(AR6K_HCI_BRIDGE_INFO));
A_MEMZERO(pHcidevInfo, sizeof(struct ar6k_hci_bridge_info));
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
g_pHcidevInfo = pHcidevInfo;
pHcidevInfo->HCITransHdl = *(HCI_TRANSPORT_MISC_HANDLES *)ar;
pHcidevInfo->HCITransHdl = *(struct hci_transport_misc_handles *)ar;
#else
ar->hcidev_info = pHcidevInfo;
pHcidevInfo->ar = ar;
@ -499,7 +499,7 @@ A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
ar->exitCallback = AR3KConfigureExit;
status = bt_setup_hci(pHcidevInfo);
if (A_FAILED(status)) {
if (status) {
break;
}
@ -509,19 +509,19 @@ A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: running in test mode... \n"));
}
pHcidevInfo->pHTCStructAlloc = (A_UINT8 *)A_MALLOC((sizeof(HTC_PACKET)) * NUM_HTC_PACKET_STRUCTS);
pHcidevInfo->pHTCStructAlloc = (u8 *)A_MALLOC((sizeof(struct htc_packet)) * NUM_HTC_PACKET_STRUCTS);
if (NULL == pHcidevInfo->pHTCStructAlloc) {
status = A_NO_MEMORY;
break;
}
pPacket = (HTC_PACKET *)pHcidevInfo->pHTCStructAlloc;
pPacket = (struct htc_packet *)pHcidevInfo->pHTCStructAlloc;
for (i = 0; i < NUM_HTC_PACKET_STRUCTS; i++,pPacket++) {
FreeHTCStruct(pHcidevInfo,pPacket);
}
A_MEMZERO(&config,sizeof(HCI_TRANSPORT_CONFIG_INFO));
A_MEMZERO(&config,sizeof(struct hci_transport_config_info));
config.ACLRecvBufferWaterMark = MAX_ACL_RECV_BUFS / 2;
config.EventRecvBufferWaterMark = MAX_EVT_RECV_BUFS / 2;
config.MaxSendQueueDepth = MAX_HCI_WRITE_QUEUE_DEPTH;
@ -544,14 +544,14 @@ A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
status = A_ERROR;
}
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
if (pHcidevInfo != NULL) {
if (NULL == pHcidevInfo->pHCIDev) {
/* GMBOX may not be present in older chips */
/* just return success */
status = A_OK;
status = 0;
}
}
ar6000_cleanup_hci(ar);
@ -563,13 +563,13 @@ A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
void ar6000_cleanup_hci(void *ar)
#else
void ar6000_cleanup_hci(AR_SOFTC_T *ar)
void ar6000_cleanup_hci(struct ar6_softc *ar)
#endif
{
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = g_pHcidevInfo;
struct ar6k_hci_bridge_info *pHcidevInfo = g_pHcidevInfo;
#else
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)ar->hcidev_info;
#endif
if (pHcidevInfo != NULL) {
@ -596,20 +596,20 @@ void ar6000_cleanup_hci(AR_SOFTC_T *ar)
}
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
A_STATUS hci_test_send(void *ar, struct sk_buff *skb)
int hci_test_send(void *ar, struct sk_buff *skb)
#else
A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb)
int hci_test_send(struct ar6_softc *ar, struct sk_buff *skb)
#endif
{
int status = A_OK;
int status = 0;
int length;
EPPING_HEADER *pHeader;
HTC_PACKET *pPacket;
struct htc_packet *pPacket;
HTC_TX_TAG htc_tag = AR6K_DATA_PKT_TAG;
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = g_pHcidevInfo;
struct ar6k_hci_bridge_info *pHcidevInfo = g_pHcidevInfo;
#else
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)ar->hcidev_info;
#endif
do {
@ -656,18 +656,18 @@ A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb)
HCI_ACL_TYPE, /* send every thing out as ACL */
htc_tag);
HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE);
HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,false);
pPacket = NULL;
} while (FALSE);
} while (false);
return status;
}
void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig)
void ar6000_set_default_ar3kconfig(struct ar6_softc *ar, void *ar3kconfig)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)ar->hcidev_info;
AR3K_CONFIG_INFO *config = (AR3K_CONFIG_INFO *)ar3kconfig;
struct ar6k_hci_bridge_info *pHcidevInfo = (struct ar6k_hci_bridge_info *)ar->hcidev_info;
struct ar3k_config_info *config = (struct ar3k_config_info *)ar3kconfig;
config->pHCIDev = pHcidevInfo->pHCIDev;
config->pHCIProps = &pHcidevInfo->HCIProps;
@ -710,9 +710,9 @@ static int bt_send_frame(struct sk_buff *skb)
{
struct hci_dev *hdev = (struct hci_dev *)skb->dev;
HCI_TRANSPORT_PACKET_TYPE type;
AR6K_HCI_BRIDGE_INFO *pHcidevInfo;
HTC_PACKET *pPacket;
A_STATUS status = A_OK;
struct ar6k_hci_bridge_info *pHcidevInfo;
struct htc_packet *pPacket;
int status = 0;
struct sk_buff *txSkb = NULL;
if (!hdev) {
@ -725,7 +725,7 @@ static int bt_send_frame(struct sk_buff *skb)
return -EBUSY;
}
pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)hdev->driver_data;
pHcidevInfo = (struct ar6k_hci_bridge_info *)hdev->driver_data;
A_ASSERT(pHcidevInfo != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("+bt_send_frame type: %d \n",bt_cb(skb)->pkt_type));
@ -747,7 +747,7 @@ static int bt_send_frame(struct sk_buff *skb)
kfree_skb(skb);
return 0;
default:
A_ASSERT(FALSE);
A_ASSERT(false);
kfree_skb(skb);
return 0;
}
@ -757,7 +757,7 @@ static int bt_send_frame(struct sk_buff *skb)
(type == HCI_COMMAND_TYPE) ? "COMMAND" : "ACL",
skb->len));
if (type == HCI_COMMAND_TYPE) {
A_UINT16 opcode = HCI_GET_OP_CODE(skb->data);
u16 opcode = HCI_GET_OP_CODE(skb->data);
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,(" HCI Command: OGF:0x%X OCF:0x%X \r\n",
opcode >> 10, opcode & 0x3FF));
}
@ -778,7 +778,7 @@ static int bt_send_frame(struct sk_buff *skb)
bt_cb(txSkb)->pkt_type = bt_cb(skb)->pkt_type;
txSkb->dev = (void *)pHcidevInfo->pBtStackHCIDev;
skb_reserve(txSkb, TX_PACKET_RSV_OFFSET + pHcidevInfo->HCIProps.HeadRoom);
A_MEMCPY(txSkb->data, skb->data, skb->len);
memcpy(txSkb->data, skb->data, skb->len);
skb_put(txSkb,skb->len);
pPacket = AllocHTCStruct(pHcidevInfo);
@ -802,11 +802,11 @@ static int bt_send_frame(struct sk_buff *skb)
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_SEND, ("HCI Bridge: type:%d, Total Length:%d Bytes \n",
type, txSkb->len));
status = HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,FALSE);
status = HCI_TransportSendPkt(pHcidevInfo->pHCIDev,pPacket,false);
pPacket = NULL;
txSkb = NULL;
} while (FALSE);
} while (false);
if (txSkb != NULL) {
kfree_skb(txSkb);
@ -832,11 +832,11 @@ static int bt_ioctl(struct hci_dev *hdev, unsigned int cmd, unsigned long arg)
*/
static int bt_flush(struct hci_dev *hdev)
{
AR6K_HCI_BRIDGE_INFO *pHcidevInfo;
struct ar6k_hci_bridge_info *pHcidevInfo;
AR_DEBUG_PRINTF(ATH_DEBUG_TRC, ("HCI Bridge: bt_flush - enter\n"));
pHcidevInfo = (AR6K_HCI_BRIDGE_INFO *)hdev->driver_data;
pHcidevInfo = (struct ar6k_hci_bridge_info *)hdev->driver_data;
/* TODO??? */
@ -853,14 +853,14 @@ static void bt_destruct(struct hci_dev *hdev)
/* nothing to do here */
}
static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static int bt_setup_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
A_STATUS status = A_OK;
int status = 0;
struct hci_dev *pHciDev = NULL;
HIF_DEVICE_OS_DEVICE_INFO osDevInfo;
struct hif_device_os_device_info osDevInfo;
if (!setupbtdev) {
return A_OK;
return 0;
}
do {
@ -868,7 +868,7 @@ static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
A_MEMZERO(&osDevInfo,sizeof(osDevInfo));
/* get the underlying OS device */
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
status = ar6000_get_hif_dev((HIF_DEVICE *)(pHcidevInfo->HCITransHdl.hifDevice),
status = ar6000_get_hif_dev((struct hif_device *)(pHcidevInfo->HCITransHdl.hifDevice),
&osDevInfo);
#else
status = HIFConfigureDevice(pHcidevInfo->ar->arHifDevice,
@ -877,7 +877,7 @@ static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
sizeof(osDevInfo));
#endif
if (A_FAILED(status)) {
if (status) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("Failed to OS device info from HIF\n"));
break;
}
@ -902,23 +902,23 @@ static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
pHciDev->destruct = bt_destruct;
pHciDev->owner = THIS_MODULE;
/* driver is running in normal BT mode */
pHcidevInfo->HciNormalMode = TRUE;
pHcidevInfo->HciNormalMode = true;
} while (FALSE);
} while (false);
if (A_FAILED(status)) {
if (status) {
bt_cleanup_hci(pHcidevInfo);
}
return status;
}
static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static void bt_cleanup_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
int err;
if (pHcidevInfo->HciRegistered) {
pHcidevInfo->HciRegistered = FALSE;
pHcidevInfo->HciRegistered = false;
clear_bit(HCI_RUNNING, &pHcidevInfo->pBtStackHCIDev->flags);
clear_bit(HCI_UP, &pHcidevInfo->pBtStackHCIDev->flags);
clear_bit(HCI_INIT, &pHcidevInfo->pBtStackHCIDev->flags);
@ -929,43 +929,41 @@ static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
}
}
if (pHcidevInfo->pBtStackHCIDev != NULL) {
kfree(pHcidevInfo->pBtStackHCIDev);
pHcidevInfo->pBtStackHCIDev = NULL;
}
kfree(pHcidevInfo->pBtStackHCIDev);
pHcidevInfo->pBtStackHCIDev = NULL;
}
static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static int bt_register_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
int err;
A_STATUS status = A_OK;
int status = 0;
do {
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: registering HCI... \n"));
A_ASSERT(pHcidevInfo->pBtStackHCIDev != NULL);
/* mark that we are registered */
pHcidevInfo->HciRegistered = TRUE;
pHcidevInfo->HciRegistered = true;
if ((err = hci_register_dev(pHcidevInfo->pBtStackHCIDev)) < 0) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HCI Bridge: failed to register with bluetooth %d\n",err));
pHcidevInfo->HciRegistered = FALSE;
pHcidevInfo->HciRegistered = false;
status = A_ERROR;
break;
}
AR_DEBUG_PRINTF(ATH_DEBUG_HCI_BRIDGE, ("HCI Bridge: HCI registered \n"));
} while (FALSE);
} while (false);
return status;
}
static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
static bool bt_indicate_recv(struct ar6k_hci_bridge_info *pHcidevInfo,
HCI_TRANSPORT_PACKET_TYPE Type,
struct sk_buff *skb)
{
A_UINT8 btType;
u8 btType;
int len;
A_BOOL success = FALSE;
bool success = false;
BT_HCI_EVENT_HEADER *pEvent;
do {
@ -984,7 +982,7 @@ static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
break;
default:
btType = 0;
A_ASSERT(FALSE);
A_ASSERT(false);
break;
}
@ -1015,14 +1013,14 @@ static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
("HCI Bridge: Indicated RCV of type:%d, Length:%d \n",btType,len));
}
success = TRUE;
success = true;
} while (FALSE);
} while (false);
return success;
}
static struct sk_buff* bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length)
static struct sk_buff* bt_alloc_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, int Length)
{
struct sk_buff *skb;
/* in normal HCI mode we need to alloc from the bt core APIs */
@ -1033,7 +1031,7 @@ static struct sk_buff* bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Le
return skb;
}
static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb)
static void bt_free_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, struct sk_buff *skb)
{
kfree_skb(skb);
}
@ -1041,36 +1039,36 @@ static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *sk
#else // { CONFIG_BLUEZ_HCI_BRIDGE
/* stubs when we only want to test the HCI bridging Interface without the HT stack */
static A_STATUS bt_setup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static int bt_setup_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
return A_OK;
return 0;
}
static void bt_cleanup_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static void bt_cleanup_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
}
static A_STATUS bt_register_hci(AR6K_HCI_BRIDGE_INFO *pHcidevInfo)
static int bt_register_hci(struct ar6k_hci_bridge_info *pHcidevInfo)
{
A_ASSERT(FALSE);
A_ASSERT(false);
return A_ERROR;
}
static A_BOOL bt_indicate_recv(AR6K_HCI_BRIDGE_INFO *pHcidevInfo,
static bool bt_indicate_recv(struct ar6k_hci_bridge_info *pHcidevInfo,
HCI_TRANSPORT_PACKET_TYPE Type,
struct sk_buff *skb)
{
A_ASSERT(FALSE);
return FALSE;
A_ASSERT(false);
return false;
}
static struct sk_buff* bt_alloc_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, int Length)
static struct sk_buff* bt_alloc_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, int Length)
{
A_ASSERT(FALSE);
A_ASSERT(false);
return NULL;
}
static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *skb)
static void bt_free_buffer(struct ar6k_hci_bridge_info *pHcidevInfo, struct sk_buff *skb)
{
A_ASSERT(FALSE);
A_ASSERT(false);
}
#endif // } CONFIG_BLUEZ_HCI_BRIDGE
@ -1080,25 +1078,25 @@ static void bt_free_buffer(AR6K_HCI_BRIDGE_INFO *pHcidevInfo, struct sk_buff *sk
/* stubs when GMBOX support is not needed */
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
A_STATUS ar6000_setup_hci(void *ar)
int ar6000_setup_hci(void *ar)
#else
A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar)
int ar6000_setup_hci(struct ar6_softc *ar)
#endif
{
return A_OK;
return 0;
}
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
void ar6000_cleanup_hci(void *ar)
#else
void ar6000_cleanup_hci(AR_SOFTC_T *ar)
void ar6000_cleanup_hci(struct ar6_softc *ar)
#endif
{
return;
}
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig)
void ar6000_set_default_ar3kconfig(struct ar6_softc *ar, void *ar3kconfig)
{
return;
}
@ -1107,7 +1105,7 @@ void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig)
#ifdef EXPORT_HCI_BRIDGE_INTERFACE
int hci_test_send(void *ar, struct sk_buff *skb)
#else
int hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb)
int hci_test_send(struct ar6_softc *ar, struct sk_buff *skb)
#endif
{
return -EOPNOTSUPP;
@ -1120,14 +1118,14 @@ int hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb)
static int __init
hcibridge_init_module(void)
{
A_STATUS status;
HCI_TRANSPORT_CALLBACKS hciTransCallbacks;
int status;
struct hci_transport_callbacks hciTransCallbacks;
hciTransCallbacks.setupTransport = ar6000_setup_hci;
hciTransCallbacks.cleanupTransport = ar6000_cleanup_hci;
status = ar6000_register_hci_transport(&hciTransCallbacks);
if(status != A_OK)
if (status)
return -ENODEV;
return 0;

View File

@ -104,7 +104,7 @@ struct USER_SAVEDKEYS {
struct ieee80211req_key ucast_ik;
struct ieee80211req_key bcast_ik;
CRYPTO_TYPE keyType;
A_BOOL keyOk;
bool keyOk;
};
#endif
@ -121,8 +121,8 @@ struct USER_SAVEDKEYS {
#define DBG_DEFAULTS (DBG_ERROR|DBG_WARNING)
A_STATUS ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
A_STATUS ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
int ar6000_ReadRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
int ar6000_WriteRegDiag(struct hif_device *hifDevice, u32 *address, u32 *data);
#ifdef __cplusplus
extern "C" {
@ -362,7 +362,7 @@ typedef struct {
int currPtr;
int length;
unsigned char data[HTC_RAW_BUFFER_SIZE];
HTC_PACKET HTCPacket;
struct htc_packet HTCPacket;
} raw_htc_buffer;
#ifdef CONFIG_HOST_TCMD_SUPPORT
@ -380,41 +380,47 @@ enum {
#endif /* CONFIG_HOST_TCMD_SUPPORT */
struct ar_wep_key {
A_UINT8 arKeyIndex;
A_UINT8 arKeyLen;
A_UINT8 arKey[64];
u8 arKeyIndex;
u8 arKeyLen;
u8 arKey[64];
} ;
#ifdef ATH6K_CONFIG_CFG80211
struct ar_key {
A_UINT8 key[WLAN_MAX_KEY_LEN];
A_UINT8 key_len;
A_UINT8 seq[IW_ENCODE_SEQ_MAX_SIZE];
A_UINT8 seq_len;
A_UINT32 cipher;
u8 key[WLAN_MAX_KEY_LEN];
u8 key_len;
u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
u8 seq_len;
u32 cipher;
};
enum {
SME_DISCONNECTED,
SME_CONNECTING,
SME_CONNECTED
};
#endif /* ATH6K_CONFIG_CFG80211 */
struct ar_node_mapping {
A_UINT8 macAddress[6];
A_UINT8 epId;
A_UINT8 txPending;
u8 macAddress[6];
u8 epId;
u8 txPending;
};
struct ar_cookie {
unsigned long arc_bp[2]; /* Must be first field */
HTC_PACKET HtcPkt; /* HTC packet wrapper */
struct htc_packet HtcPkt; /* HTC packet wrapper */
struct ar_cookie *arc_list_next;
};
struct ar_hb_chlng_resp {
A_TIMER timer;
A_UINT32 frequency;
A_UINT32 seqNum;
A_BOOL outstanding;
A_UINT8 missCnt;
A_UINT8 missThres;
u32 frequency;
u32 seqNum;
bool outstanding;
u8 missCnt;
u8 missThres;
};
/* Per STA data, used in AP mode */
@ -436,13 +442,13 @@ struct ar_hb_chlng_resp {
#define STA_IS_PS_POLLED(sta) (sta->flags & (STA_PS_POLLED_MASK << STA_PS_POLLED_SHIFT))
typedef struct {
A_UINT16 flags;
A_UINT8 mac[ATH_MAC_LEN];
A_UINT8 aid;
A_UINT8 keymgmt;
A_UINT8 ucipher;
A_UINT8 auth;
A_UINT8 wpa_ie[IEEE80211_MAX_IE];
u16 flags;
u8 mac[ATH_MAC_LEN];
u8 aid;
u8 keymgmt;
u8 ucipher;
u8 auth;
u8 wpa_ie[IEEE80211_MAX_IE];
A_NETBUF_QUEUE_T psq; /* power save q */
A_MUTEX_T psqLock;
} sta_t;
@ -456,173 +462,174 @@ typedef struct ar6_raw_htc {
wait_queue_head_t raw_htc_write_queue[HTC_RAW_STREAM_NUM_MAX];
raw_htc_buffer raw_htc_read_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_READ_BUFFERS_NUM];
raw_htc_buffer raw_htc_write_buffer[HTC_RAW_STREAM_NUM_MAX][RAW_HTC_WRITE_BUFFERS_NUM];
A_BOOL write_buffer_available[HTC_RAW_STREAM_NUM_MAX];
A_BOOL read_buffer_available[HTC_RAW_STREAM_NUM_MAX];
bool write_buffer_available[HTC_RAW_STREAM_NUM_MAX];
bool read_buffer_available[HTC_RAW_STREAM_NUM_MAX];
} AR_RAW_HTC_T;
typedef struct ar6_softc {
struct ar6_softc {
struct net_device *arNetDev; /* net_device pointer */
void *arWmi;
int arTxPending[ENDPOINT_MAX];
int arTotalTxDataPending;
A_UINT8 arNumDataEndPts;
A_BOOL arWmiEnabled;
A_BOOL arWmiReady;
A_BOOL arConnected;
u8 arNumDataEndPts;
bool arWmiEnabled;
bool arWmiReady;
bool arConnected;
HTC_HANDLE arHtcTarget;
void *arHifDevice;
spinlock_t arLock;
struct semaphore arSem;
int arSsidLen;
u_char arSsid[32];
A_UINT8 arNextMode;
A_UINT8 arNetworkType;
A_UINT8 arDot11AuthMode;
A_UINT8 arAuthMode;
A_UINT8 arPairwiseCrypto;
A_UINT8 arPairwiseCryptoLen;
A_UINT8 arGroupCrypto;
A_UINT8 arGroupCryptoLen;
A_UINT8 arDefTxKeyIndex;
u8 arNextMode;
u8 arNetworkType;
u8 arDot11AuthMode;
u8 arAuthMode;
u8 arPairwiseCrypto;
u8 arPairwiseCryptoLen;
u8 arGroupCrypto;
u8 arGroupCryptoLen;
u8 arDefTxKeyIndex;
struct ar_wep_key arWepKeyList[WMI_MAX_KEY_INDEX + 1];
A_UINT8 arBssid[6];
A_UINT8 arReqBssid[6];
A_UINT16 arChannelHint;
A_UINT16 arBssChannel;
A_UINT16 arListenIntervalB;
A_UINT16 arListenIntervalT;
u8 arBssid[6];
u8 arReqBssid[6];
u16 arChannelHint;
u16 arBssChannel;
u16 arListenIntervalB;
u16 arListenIntervalT;
struct ar6000_version arVersion;
A_UINT32 arTargetType;
A_INT8 arRssi;
A_UINT8 arTxPwr;
A_BOOL arTxPwrSet;
A_INT32 arBitRate;
u32 arTargetType;
s8 arRssi;
u8 arTxPwr;
bool arTxPwrSet;
s32 arBitRate;
struct net_device_stats arNetStats;
struct iw_statistics arIwStats;
A_INT8 arNumChannels;
A_UINT16 arChannelList[32];
A_UINT32 arRegCode;
A_BOOL statsUpdatePending;
s8 arNumChannels;
u16 arChannelList[32];
u32 arRegCode;
bool statsUpdatePending;
TARGET_STATS arTargetStats;
A_INT8 arMaxRetries;
A_UINT8 arPhyCapability;
s8 arMaxRetries;
u8 arPhyCapability;
#ifdef CONFIG_HOST_TCMD_SUPPORT
A_UINT8 tcmdRxReport;
A_UINT32 tcmdRxTotalPkt;
A_INT32 tcmdRxRssi;
A_UINT32 tcmdPm;
A_UINT32 arTargetMode;
A_UINT32 tcmdRxcrcErrPkt;
A_UINT32 tcmdRxsecErrPkt;
A_UINT16 tcmdRateCnt[TCMD_MAX_RATES];
A_UINT16 tcmdRateCntShortGuard[TCMD_MAX_RATES];
u8 tcmdRxReport;
u32 tcmdRxTotalPkt;
s32 tcmdRxRssi;
u32 tcmdPm;
u32 arTargetMode;
u32 tcmdRxcrcErrPkt;
u32 tcmdRxsecErrPkt;
u16 tcmdRateCnt[TCMD_MAX_RATES];
u16 tcmdRateCntShortGuard[TCMD_MAX_RATES];
#endif
AR6000_WLAN_STATE arWlanState;
struct ar_node_mapping arNodeMap[MAX_NODE_NUM];
A_UINT8 arIbssPsEnable;
A_UINT8 arNodeNum;
A_UINT8 arNexEpId;
u8 arIbssPsEnable;
u8 arNodeNum;
u8 arNexEpId;
struct ar_cookie *arCookieList;
A_UINT32 arCookieCount;
A_UINT32 arRateMask;
A_UINT8 arSkipScan;
A_UINT16 arBeaconInterval;
A_BOOL arConnectPending;
A_BOOL arWmmEnabled;
u32 arCookieCount;
u32 arRateMask;
u8 arSkipScan;
u16 arBeaconInterval;
bool arConnectPending;
bool arWmmEnabled;
struct ar_hb_chlng_resp arHBChallengeResp;
A_UINT8 arKeepaliveConfigured;
A_UINT32 arMgmtFilter;
u8 arKeepaliveConfigured;
u32 arMgmtFilter;
HTC_ENDPOINT_ID arAc2EpMapping[WMM_NUM_AC];
A_BOOL arAcStreamActive[WMM_NUM_AC];
A_UINT8 arAcStreamPriMap[WMM_NUM_AC];
A_UINT8 arHiAcStreamActivePri;
A_UINT8 arEp2AcMapping[ENDPOINT_MAX];
bool arAcStreamActive[WMM_NUM_AC];
u8 arAcStreamPriMap[WMM_NUM_AC];
u8 arHiAcStreamActivePri;
u8 arEp2AcMapping[ENDPOINT_MAX];
HTC_ENDPOINT_ID arControlEp;
#ifdef HTC_RAW_INTERFACE
AR_RAW_HTC_T *arRawHtc;
#endif
A_BOOL arNetQueueStopped;
A_BOOL arRawIfInit;
bool arNetQueueStopped;
bool arRawIfInit;
int arDeviceIndex;
COMMON_CREDIT_STATE_INFO arCreditStateInfo;
A_BOOL arWMIControlEpFull;
A_BOOL dbgLogFetchInProgress;
A_UCHAR log_buffer[DBGLOG_HOST_LOG_BUFFER_SIZE];
A_UINT32 log_cnt;
A_UINT32 dbglog_init_done;
A_UINT32 arConnectCtrlFlags;
struct common_credit_state_info arCreditStateInfo;
bool arWMIControlEpFull;
bool dbgLogFetchInProgress;
u8 log_buffer[DBGLOG_HOST_LOG_BUFFER_SIZE];
u32 log_cnt;
u32 dbglog_init_done;
u32 arConnectCtrlFlags;
#ifdef USER_KEYS
A_INT32 user_savedkeys_stat;
A_UINT32 user_key_ctrl;
s32 user_savedkeys_stat;
u32 user_key_ctrl;
struct USER_SAVEDKEYS user_saved_keys;
#endif
USER_RSSI_THOLD rssi_map[12];
A_UINT8 arUserBssFilter;
A_UINT16 ap_profile_flag; /* AP mode */
u8 arUserBssFilter;
u16 ap_profile_flag; /* AP mode */
WMI_AP_ACL g_acl; /* AP mode */
sta_t sta_list[AP_MAX_NUM_STA]; /* AP mode */
A_UINT8 sta_list_index; /* AP mode */
u8 sta_list_index; /* AP mode */
struct ieee80211req_key ap_mode_bkey; /* AP mode */
A_NETBUF_QUEUE_T mcastpsq; /* power save q for Mcast frames */
A_MUTEX_T mcastpsqLock;
A_BOOL DTIMExpired; /* flag to indicate DTIM expired */
A_UINT8 intra_bss; /* enable/disable intra bss data forward */
bool DTIMExpired; /* flag to indicate DTIM expired */
u8 intra_bss; /* enable/disable intra bss data forward */
void *aggr_cntxt;
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
void *hcidev_info;
#endif
void *hcipal_info;
WMI_AP_MODE_STAT arAPStats;
A_UINT8 ap_hidden_ssid;
A_UINT8 ap_country_code[3];
A_UINT8 ap_wmode;
A_UINT8 ap_dtim_period;
A_UINT16 ap_beacon_interval;
A_UINT16 arRTS;
A_UINT16 arACS; /* AP mode - Auto Channel Selection */
HTC_PACKET_QUEUE amsdu_rx_buffer_queue;
A_BOOL bIsDestroyProgress; /* flag to indicate ar6k destroy is in progress */
u8 ap_hidden_ssid;
u8 ap_country_code[3];
u8 ap_wmode;
u8 ap_dtim_period;
u16 ap_beacon_interval;
u16 arRTS;
u16 arACS; /* AP mode - Auto Channel Selection */
struct htc_packet_queue amsdu_rx_buffer_queue;
bool bIsDestroyProgress; /* flag to indicate ar6k destroy is in progress */
A_TIMER disconnect_timer;
A_UINT8 rxMetaVersion;
u8 rxMetaVersion;
#ifdef WAPI_ENABLE
A_UINT8 arWapiEnable;
u8 arWapiEnable;
#endif
WMI_BTCOEX_CONFIG_EVENT arBtcoexConfig;
WMI_BTCOEX_STATS_EVENT arBtcoexStats;
A_INT32 (*exitCallback)(void *config); /* generic callback at AR6K exit */
HIF_DEVICE_OS_DEVICE_INFO osDevInfo;
s32 (*exitCallback)(void *config); /* generic callback at AR6K exit */
struct hif_device_os_device_info osDevInfo;
#ifdef ATH6K_CONFIG_CFG80211
struct wireless_dev *wdev;
struct cfg80211_scan_request *scan_request;
struct ar_key keys[WMI_MAX_KEY_INDEX + 1];
u32 smeState;
#endif /* ATH6K_CONFIG_CFG80211 */
A_UINT16 arWlanPowerState;
A_BOOL arWlanOff;
u16 arWlanPowerState;
bool arWlanOff;
#ifdef CONFIG_PM
A_UINT16 arWowState;
A_BOOL arBTOff;
A_BOOL arBTSharing;
A_UINT16 arSuspendConfig;
A_UINT16 arWlanOffConfig;
A_UINT16 arWow2Config;
u16 arWowState;
bool arBTOff;
bool arBTSharing;
u16 arSuspendConfig;
u16 arWlanOffConfig;
u16 arWow2Config;
#endif
A_UINT8 scan_triggered;
u8 scan_triggered;
WMI_SCAN_PARAMS_CMD scParams;
#define AR_MCAST_FILTER_MAC_ADDR_SIZE 4
A_UINT8 mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE];
A_UINT8 bdaddr[6];
A_BOOL scanSpecificSsid;
u8 mcast_filters[MAC_MAX_FILTERS_PER_LIST][AR_MCAST_FILTER_MAC_ADDR_SIZE];
u8 bdaddr[6];
bool scanSpecificSsid;
#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
void *arApDev;
#endif
} AR_SOFTC_T;
};
#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
typedef struct {
struct ar_virtual_interface {
struct net_device *arNetDev; /* net_device pointer */
AR_SOFTC_T *arDev; /* ar device pointer */
struct ar6_softc *arDev; /* ar device pointer */
struct net_device *arStaNetDev; /* net_device pointer */
} AR_VIRTUAL_INTERFACE_T;
};
#endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
#ifdef ATH6K_CONFIG_CFG80211
@ -638,7 +645,7 @@ static inline void *ar6k_priv(struct net_device *dev)
if (arApNetDev == dev) {
/* return arDev saved in virtual interface context */
AR_VIRTUAL_INTERFACE_T *arVirDev;
struct ar_virtual_interface *arVirDev;
arVirDev = netdev_priv(dev);
return arVirDev->arDev;
} else {
@ -672,9 +679,9 @@ static inline void *ar6k_priv(struct net_device *dev)
#define arEndpoint2RawStreamID(ar,ep) (ar)->arRawHtc->arEp2RawMapping[(ep)]
struct ar_giwscan_param {
char *current_ev;
char *end_buf;
A_UINT32 bytes_needed;
char *current_ev;
char *end_buf;
u32 bytes_needed;
struct iw_request_info *info;
};
@ -697,14 +704,14 @@ struct ar_giwscan_param {
int ar6000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
int ar6000_ioctl_dispatcher(struct net_device *dev, struct ifreq *rq, int cmd);
void ar6000_gpio_init(void);
void ar6000_init_profile_info(AR_SOFTC_T *ar);
void ar6000_install_static_wep_keys(AR_SOFTC_T *ar);
void ar6000_init_profile_info(struct ar6_softc *ar);
void ar6000_install_static_wep_keys(struct ar6_softc *ar);
int ar6000_init(struct net_device *dev);
int ar6000_dbglog_get_debug_logs(AR_SOFTC_T *ar);
void ar6000_TxDataCleanup(AR_SOFTC_T *ar);
int ar6000_dbglog_get_debug_logs(struct ar6_softc *ar);
void ar6000_TxDataCleanup(struct ar6_softc *ar);
int ar6000_acl_data_tx(struct sk_buff *skb, struct net_device *dev);
void ar6000_restart_endpoint(struct net_device *dev);
void ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL getdbglogs);
void ar6000_stop_endpoint(struct net_device *dev, bool keepprofile, bool getdbglogs);
#ifdef HTC_RAW_INTERFACE
@ -712,12 +719,12 @@ void ar6000_stop_endpoint(struct net_device *dev, A_BOOL keepprofile, A_BOOL get
#define __user
#endif
int ar6000_htc_raw_open(AR_SOFTC_T *ar);
int ar6000_htc_raw_close(AR_SOFTC_T *ar);
ssize_t ar6000_htc_raw_read(AR_SOFTC_T *ar,
int ar6000_htc_raw_open(struct ar6_softc *ar);
int ar6000_htc_raw_close(struct ar6_softc *ar);
ssize_t ar6000_htc_raw_read(struct ar6_softc *ar,
HTC_RAW_STREAM_ID StreamID,
char __user *buffer, size_t count);
ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar,
ssize_t ar6000_htc_raw_write(struct ar6_softc *ar,
HTC_RAW_STREAM_ID StreamID,
char __user *buffer, size_t count);
@ -726,23 +733,22 @@ ssize_t ar6000_htc_raw_write(AR_SOFTC_T *ar,
/* AP mode */
/*TODO: These routines should be moved to a file that is common across OS */
sta_t *
ieee80211_find_conn(AR_SOFTC_T *ar, A_UINT8 *node_addr);
ieee80211_find_conn(struct ar6_softc *ar, u8 *node_addr);
sta_t *
ieee80211_find_conn_for_aid(AR_SOFTC_T *ar, A_UINT8 aid);
ieee80211_find_conn_for_aid(struct ar6_softc *ar, u8 aid);
A_UINT8
remove_sta(AR_SOFTC_T *ar, A_UINT8 *mac, A_UINT16 reason);
u8 remove_sta(struct ar6_softc *ar, u8 *mac, u16 reason);
/* HCI support */
#ifndef EXPORT_HCI_BRIDGE_INTERFACE
A_STATUS ar6000_setup_hci(AR_SOFTC_T *ar);
void ar6000_cleanup_hci(AR_SOFTC_T *ar);
void ar6000_set_default_ar3kconfig(AR_SOFTC_T *ar, void *ar3kconfig);
int ar6000_setup_hci(struct ar6_softc *ar);
void ar6000_cleanup_hci(struct ar6_softc *ar);
void ar6000_set_default_ar3kconfig(struct ar6_softc *ar, void *ar3kconfig);
/* HCI bridge testing */
A_STATUS hci_test_send(AR_SOFTC_T *ar, struct sk_buff *skb);
int hci_test_send(struct ar6_softc *ar, struct sk_buff *skb);
#endif
ATH_DEBUG_DECLARE_EXTERN(htc);
@ -752,8 +758,8 @@ ATH_DEBUG_DECLARE_EXTERN(hif);
ATH_DEBUG_DECLARE_EXTERN(wlan);
ATH_DEBUG_DECLARE_EXTERN(misc);
extern A_UINT8 bcast_mac[];
extern A_UINT8 null_mac[];
extern u8 bcast_mac[];
extern u8 null_mac[];
#ifdef __cplusplus
}

View File

@ -21,12 +21,12 @@
//==============================================================================
#ifndef _AR6K_PAL_H_
#define _AR6K_PAL_H_
#define HCI_GET_OP_CODE(p) (((A_UINT16)((p)[1])) << 8) | ((A_UINT16)((p)[0]))
#define HCI_GET_OP_CODE(p) (((u16)((p)[1])) << 8) | ((u16)((p)[0]))
/* transmit packet reserve offset */
#define TX_PACKET_RSV_OFFSET 32
/* pal specific config structure */
typedef A_BOOL (*ar6k_pal_recv_pkt_t)(void *pHciPalInfo, void *skb);
typedef bool (*ar6k_pal_recv_pkt_t)(void *pHciPalInfo, void *skb);
typedef struct ar6k_pal_config_s
{
ar6k_pal_recv_pkt_t fpar6k_pal_recv_pkt;

View File

@ -29,37 +29,37 @@ extern "C" {
struct ar6_softc;
void ar6000_ready_event(void *devt, A_UINT8 *datap, A_UINT8 phyCap,
A_UINT32 sw_ver, A_UINT32 abi_ver);
A_STATUS ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid);
void ar6000_connect_event(struct ar6_softc *ar, A_UINT16 channel,
A_UINT8 *bssid, A_UINT16 listenInterval,
A_UINT16 beaconInterval, NETWORK_TYPE networkType,
A_UINT8 beaconIeLen, A_UINT8 assocReqLen,
A_UINT8 assocRespLen,A_UINT8 *assocInfo);
void ar6000_disconnect_event(struct ar6_softc *ar, A_UINT8 reason,
A_UINT8 *bssid, A_UINT8 assocRespLen,
A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus);
void ar6000_tkip_micerr_event(struct ar6_softc *ar, A_UINT8 keyid,
A_BOOL ismcast);
void ar6000_bitrate_rx(void *devt, A_INT32 rateKbps);
void ar6000_channelList_rx(void *devt, A_INT8 numChan, A_UINT16 *chanList);
void ar6000_regDomain_event(struct ar6_softc *ar, A_UINT32 regCode);
void ar6000_txPwr_rx(void *devt, A_UINT8 txPwr);
void ar6000_keepalive_rx(void *devt, A_UINT8 configured);
void ar6000_ready_event(void *devt, u8 *datap, u8 phyCap,
u32 sw_ver, u32 abi_ver);
int ar6000_control_tx(void *devt, void *osbuf, HTC_ENDPOINT_ID eid);
void ar6000_connect_event(struct ar6_softc *ar, u16 channel,
u8 *bssid, u16 listenInterval,
u16 beaconInterval, NETWORK_TYPE networkType,
u8 beaconIeLen, u8 assocReqLen,
u8 assocRespLen,u8 *assocInfo);
void ar6000_disconnect_event(struct ar6_softc *ar, u8 reason,
u8 *bssid, u8 assocRespLen,
u8 *assocInfo, u16 protocolReasonStatus);
void ar6000_tkip_micerr_event(struct ar6_softc *ar, u8 keyid,
bool ismcast);
void ar6000_bitrate_rx(void *devt, s32 rateKbps);
void ar6000_channelList_rx(void *devt, s8 numChan, u16 *chanList);
void ar6000_regDomain_event(struct ar6_softc *ar, u32 regCode);
void ar6000_txPwr_rx(void *devt, u8 txPwr);
void ar6000_keepalive_rx(void *devt, u8 configured);
void ar6000_neighborReport_event(struct ar6_softc *ar, int numAps,
WMI_NEIGHBOR_INFO *info);
void ar6000_set_numdataendpts(struct ar6_softc *ar, A_UINT32 num);
void ar6000_scanComplete_event(struct ar6_softc *ar, A_STATUS status);
void ar6000_targetStats_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len);
void ar6000_set_numdataendpts(struct ar6_softc *ar, u32 num);
void ar6000_scanComplete_event(struct ar6_softc *ar, int status);
void ar6000_targetStats_event(struct ar6_softc *ar, u8 *ptr, u32 len);
void ar6000_rssiThreshold_event(struct ar6_softc *ar,
WMI_RSSI_THRESHOLD_VAL newThreshold,
A_INT16 rssi);
s16 rssi);
void ar6000_reportError_event(struct ar6_softc *, WMI_TARGET_ERROR_VAL errorVal);
void ar6000_cac_event(struct ar6_softc *ar, A_UINT8 ac, A_UINT8 cac_indication,
A_UINT8 statusCode, A_UINT8 *tspecSuggestion);
void ar6000_channel_change_event(struct ar6_softc *ar, A_UINT16 oldChannel, A_UINT16 newChannel);
void ar6000_hbChallengeResp_event(struct ar6_softc *, A_UINT32 cookie, A_UINT32 source);
void ar6000_cac_event(struct ar6_softc *ar, u8 ac, u8 cac_indication,
u8 statusCode, u8 *tspecSuggestion);
void ar6000_channel_change_event(struct ar6_softc *ar, u16 oldChannel, u16 newChannel);
void ar6000_hbChallengeResp_event(struct ar6_softc *, u32 cookie, u32 source);
void
ar6000_roam_tbl_event(struct ar6_softc *ar, WMI_TARGET_ROAM_TBL *pTbl);
@ -67,96 +67,96 @@ void
ar6000_roam_data_event(struct ar6_softc *ar, WMI_TARGET_ROAM_DATA *p);
void
ar6000_wow_list_event(struct ar6_softc *ar, A_UINT8 num_filters,
ar6000_wow_list_event(struct ar6_softc *ar, u8 num_filters,
WMI_GET_WOW_LIST_REPLY *wow_reply);
void ar6000_pmkid_list_event(void *devt, A_UINT8 numPMKID,
WMI_PMKID *pmkidList, A_UINT8 *bssidList);
void ar6000_pmkid_list_event(void *devt, u8 numPMKID,
WMI_PMKID *pmkidList, u8 *bssidList);
void ar6000_gpio_intr_rx(A_UINT32 intr_mask, A_UINT32 input_values);
void ar6000_gpio_data_rx(A_UINT32 reg_id, A_UINT32 value);
void ar6000_gpio_intr_rx(u32 intr_mask, u32 input_values);
void ar6000_gpio_data_rx(u32 reg_id, u32 value);
void ar6000_gpio_ack_rx(void);
A_INT32 rssi_compensation_calc_tcmd(A_UINT32 freq, A_INT32 rssi, A_UINT32 totalPkt);
A_INT16 rssi_compensation_calc(struct ar6_softc *ar, A_INT16 rssi);
A_INT16 rssi_compensation_reverse_calc(struct ar6_softc *ar, A_INT16 rssi, A_BOOL Above);
s32 rssi_compensation_calc_tcmd(u32 freq, s32 rssi, u32 totalPkt);
s16 rssi_compensation_calc(struct ar6_softc *ar, s16 rssi);
s16 rssi_compensation_reverse_calc(struct ar6_softc *ar, s16 rssi, bool Above);
void ar6000_dbglog_init_done(struct ar6_softc *ar);
#ifdef SEND_EVENT_TO_APP
void ar6000_send_event_to_app(struct ar6_softc *ar, A_UINT16 eventId, A_UINT8 *datap, int len);
void ar6000_send_generic_event_to_app(struct ar6_softc *ar, A_UINT16 eventId, A_UINT8 *datap, int len);
void ar6000_send_event_to_app(struct ar6_softc *ar, u16 eventId, u8 *datap, int len);
void ar6000_send_generic_event_to_app(struct ar6_softc *ar, u16 eventId, u8 *datap, int len);
#endif
#ifdef CONFIG_HOST_TCMD_SUPPORT
void ar6000_tcmd_rx_report_event(void *devt, A_UINT8 * results, int len);
void ar6000_tcmd_rx_report_event(void *devt, u8 *results, int len);
#endif
void ar6000_tx_retry_err_event(void *devt);
void ar6000_snrThresholdEvent_rx(void *devt,
WMI_SNR_THRESHOLD_VAL newThreshold,
A_UINT8 snr);
u8 snr);
void ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL range, A_UINT8 lqVal);
void ar6000_lqThresholdEvent_rx(void *devt, WMI_LQ_THRESHOLD_VAL range, u8 lqVal);
void ar6000_ratemask_rx(void *devt, A_UINT32 ratemask);
void ar6000_ratemask_rx(void *devt, u32 ratemask);
A_STATUS ar6000_get_driver_cfg(struct net_device *dev,
A_UINT16 cfgParam,
int ar6000_get_driver_cfg(struct net_device *dev,
u16 cfgParam,
void *result);
void ar6000_bssInfo_event_rx(struct ar6_softc *ar, A_UINT8 *data, int len);
void ar6000_bssInfo_event_rx(struct ar6_softc *ar, u8 *data, int len);
void ar6000_dbglog_event(struct ar6_softc *ar, A_UINT32 dropped,
A_INT8 *buffer, A_UINT32 length);
void ar6000_dbglog_event(struct ar6_softc *ar, u32 dropped,
s8 *buffer, u32 length);
int ar6000_dbglog_get_debug_logs(struct ar6_softc *ar);
void ar6000_peer_event(void *devt, A_UINT8 eventCode, A_UINT8 *bssid);
void ar6000_peer_event(void *devt, u8 eventCode, u8 *bssid);
void ar6000_indicate_tx_activity(void *devt, A_UINT8 trafficClass, A_BOOL Active);
HTC_ENDPOINT_ID ar6000_ac2_endpoint_id ( void * devt, A_UINT8 ac);
A_UINT8 ar6000_endpoint_id2_ac (void * devt, HTC_ENDPOINT_ID ep );
void ar6000_indicate_tx_activity(void *devt, u8 trafficClass, bool Active);
HTC_ENDPOINT_ID ar6000_ac2_endpoint_id ( void * devt, u8 ac);
u8 ar6000_endpoint_id2_ac (void * devt, HTC_ENDPOINT_ID ep );
void ar6000_btcoex_config_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len);
void ar6000_btcoex_config_event(struct ar6_softc *ar, u8 *ptr, u32 len);
void ar6000_btcoex_stats_event(struct ar6_softc *ar, A_UINT8 *ptr, A_UINT32 len) ;
void ar6000_btcoex_stats_event(struct ar6_softc *ar, u8 *ptr, u32 len) ;
void ar6000_dset_open_req(void *devt,
A_UINT32 id,
A_UINT32 targ_handle,
A_UINT32 targ_reply_fn,
A_UINT32 targ_reply_arg);
void ar6000_dset_close(void *devt, A_UINT32 access_cookie);
u32 id,
u32 targ_handle,
u32 targ_reply_fn,
u32 targ_reply_arg);
void ar6000_dset_close(void *devt, u32 access_cookie);
void ar6000_dset_data_req(void *devt,
A_UINT32 access_cookie,
A_UINT32 offset,
A_UINT32 length,
A_UINT32 targ_buf,
A_UINT32 targ_reply_fn,
A_UINT32 targ_reply_arg);
u32 access_cookie,
u32 offset,
u32 length,
u32 targ_buf,
u32 targ_reply_fn,
u32 targ_reply_arg);
#if defined(CONFIG_TARGET_PROFILE_SUPPORT)
void prof_count_rx(unsigned int addr, unsigned int count);
#endif
A_UINT32 ar6000_getnodeAge (void);
u32 ar6000_getnodeAge (void);
A_UINT32 ar6000_getclkfreq (void);
u32 ar6000_getclkfreq (void);
int ar6000_ap_mode_profile_commit(struct ar6_softc *ar);
struct ieee80211req_wpaie;
A_STATUS
int
ar6000_ap_mode_get_wpa_ie(struct ar6_softc *ar, struct ieee80211req_wpaie *wpaie);
A_STATUS is_iwioctl_allowed(A_UINT8 mode, A_UINT16 cmd);
int is_iwioctl_allowed(u8 mode, u16 cmd);
A_STATUS is_xioctl_allowed(A_UINT8 mode, int cmd);
int is_xioctl_allowed(u8 mode, int cmd);
void ar6000_pspoll_event(struct ar6_softc *ar,A_UINT8 aid);
void ar6000_pspoll_event(struct ar6_softc *ar,u8 aid);
void ar6000_dtimexpiry_event(struct ar6_softc *ar);
@ -167,27 +167,28 @@ void ar6000_hci_event_rcv_evt(struct ar6_softc *ar, WMI_HCI_EVENT *cmd);
#ifdef WAPI_ENABLE
int ap_set_wapi_key(struct ar6_softc *ar, void *ik);
void ap_wapi_rekey_event(struct ar6_softc *ar, A_UINT8 type, A_UINT8 *mac);
void ap_wapi_rekey_event(struct ar6_softc *ar, u8 type, u8 *mac);
#endif
A_STATUS ar6000_connect_to_ap(struct ar6_softc *ar);
A_STATUS ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, A_BOOL suspending);
A_STATUS ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state);
A_STATUS ar6000_set_bt_hw_state(struct ar6_softc *ar, A_UINT32 state);
int ar6000_connect_to_ap(struct ar6_softc *ar);
int ar6000_disconnect(struct ar6_softc *ar);
int ar6000_update_wlan_pwr_state(struct ar6_softc *ar, AR6000_WLAN_STATE state, bool suspending);
int ar6000_set_wlan_state(struct ar6_softc *ar, AR6000_WLAN_STATE state);
int ar6000_set_bt_hw_state(struct ar6_softc *ar, u32 state);
#ifdef CONFIG_PM
A_STATUS ar6000_suspend_ev(void *context);
A_STATUS ar6000_resume_ev(void *context);
A_STATUS ar6000_power_change_ev(void *context, A_UINT32 config);
void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, A_BOOL isEvent);
int ar6000_suspend_ev(void *context);
int ar6000_resume_ev(void *context);
int ar6000_power_change_ev(void *context, u32 config);
void ar6000_check_wow_status(struct ar6_softc *ar, struct sk_buff *skb, bool isEvent);
#endif
void ar6000_pm_init(void);
void ar6000_pm_exit(void);
#ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT
A_STATUS ar6000_add_ap_interface(struct ar6_softc *ar, char *ifname);
A_STATUS ar6000_remove_ap_interface(struct ar6_softc *ar);
int ar6000_add_ap_interface(struct ar6_softc *ar, char *ifname);
int ar6000_remove_ap_interface(struct ar6_softc *ar);
#endif /* CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */
#ifdef __cplusplus

View File

@ -531,7 +531,7 @@ typedef enum {
* UINT32 cmd (AR6000_XIOCTL_WMI_STARTSCAN)
* UINT8 scanType
* UINT8 scanConnected
* A_BOOL forceFgScan
* u32 forceFgScan
* uses: WMI_START_SCAN_CMDID
*/
@ -625,7 +625,7 @@ typedef enum {
* arguments:
* UINT32 cmd (AR6000_XIOCTL_USER_SETKEYS)
* UINT32 keyOpCtrl
* uses AR6000_USER_SETKEYS_INFO
* uses struct ar6000_user_setkeys_info
*/
#define AR6000_XIOCTL_USER_SETKEYS 58
#endif /* USER_KEYS */
@ -643,7 +643,7 @@ typedef enum {
* arguments:
* UINT8 cmd (AR6000_XIOCTL_WMI_GET_KEEPALIVE)
* UINT8 keepaliveInterval
* A_BOOL configured
* u32 configured
* uses: WMI_GET_KEEPALIVE_CMDID
*/
@ -660,7 +660,7 @@ typedef enum {
* UINT32 number of bytes
* UINT32 activate? (0 or 1)
* }
* A_UINT32 resulting rompatch ID
* u32 resulting rompatch ID
* }
* uses: BMI_ROMPATCH_INSTALL
*/
@ -710,7 +710,7 @@ typedef enum {
#define AR6000_XIOCTL_WMI_SET_MGMT_FRM_RX_FILTER 66
/*
* arguments:
* A_UINT32 filter_type;
* u32 filter_type;
*/
#define AR6000_XIOCTL_DBGLOG_CFG_MODULE 67
@ -720,15 +720,15 @@ typedef enum {
#define AR6000_XIOCTL_WMI_SET_WSC_STATUS 70
/*
* arguments:
* A_UINT32 wsc_status;
* u32 wsc_status;
* (WSC_REG_INACTIVE or WSC_REG_ACTIVE)
*/
/*
* arguments:
* struct {
* A_UINT8 streamType;
* A_UINT8 status;
* u8 streamType;
* u8 status;
* }
* uses: WMI_SET_BT_STATUS_CMDID
*/
@ -737,9 +737,9 @@ typedef enum {
/*
* arguments:
* struct {
* A_UINT8 paramType;
* u8 paramType;
* union {
* A_UINT8 noSCOPkts;
* u8 noSCOPkts;
* BT_PARAMS_A2DP a2dpParams;
* BT_COEX_REGS regs;
* };
@ -760,8 +760,8 @@ typedef enum {
/*
* arguments:
* UINT32 cmd (AR6000_XIOCTL_TARGET_INFO)
* A_UINT32 TargetVersion (returned)
* A_UINT32 TargetType (returned)
* u32 TargetVersion (returned)
* u32 TargetType (returned)
* (See also bmi_msg.h target_ver and target_type)
*/
@ -786,7 +786,7 @@ typedef enum {
* This ioctl is used to set the connect control flags
*
* arguments:
* A_UINT32 connectCtrlFlags
* u32 connectCtrlFlags
*/
#define AR6000_XIOCTL_WMI_SET_AKMP_PARAMS 82
@ -798,7 +798,7 @@ typedef enum {
*
* arguments:
* struct {
* A_UINT32 akmpInfo;
* u32 akmpInfo;
* }
* uses: WMI_SET_AKMP_PARAMS_CMD
*/
@ -814,7 +814,7 @@ typedef enum {
*
* arguments:
* struct {
* A_UINT32 numPMKID;
* u32 numPMKID;
* WMI_PMKID pmkidList[WMI_MAX_PMKID_CACHE];
* }
* uses: WMI_SET_PMKIDLIST_CMD
@ -850,14 +850,14 @@ typedef enum {
#define AR6000_XIOCTL_PROF_CFG 93
/*
* arguments:
* A_UINT32 period
* A_UINT32 nbins
* u32 period
* u32 nbins
*/
#define AR6000_XIOCTL_PROF_ADDR_SET 94
/*
* arguments:
* A_UINT32 Target address
* u32 Target address
*/
#define AR6000_XIOCTL_PROF_START 95
@ -997,91 +997,92 @@ typedef enum {
#define AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM 154
#define AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES 161
/* used by AR6000_IOCTL_WMI_GETREV */
struct ar6000_version {
A_UINT32 host_ver;
A_UINT32 target_ver;
A_UINT32 wlan_ver;
A_UINT32 abi_ver;
u32 host_ver;
u32 target_ver;
u32 wlan_ver;
u32 abi_ver;
};
/* used by AR6000_IOCTL_WMI_GET_QOS_QUEUE */
struct ar6000_queuereq {
A_UINT8 trafficClass;
A_UINT16 activeTsids;
u8 trafficClass;
u16 activeTsids;
};
/* used by AR6000_IOCTL_WMI_GET_TARGET_STATS */
typedef struct targetStats_t {
A_UINT64 tx_packets;
A_UINT64 tx_bytes;
A_UINT64 tx_unicast_pkts;
A_UINT64 tx_unicast_bytes;
A_UINT64 tx_multicast_pkts;
A_UINT64 tx_multicast_bytes;
A_UINT64 tx_broadcast_pkts;
A_UINT64 tx_broadcast_bytes;
A_UINT64 tx_rts_success_cnt;
A_UINT64 tx_packet_per_ac[4];
u64 tx_packets;
u64 tx_bytes;
u64 tx_unicast_pkts;
u64 tx_unicast_bytes;
u64 tx_multicast_pkts;
u64 tx_multicast_bytes;
u64 tx_broadcast_pkts;
u64 tx_broadcast_bytes;
u64 tx_rts_success_cnt;
u64 tx_packet_per_ac[4];
A_UINT64 tx_errors;
A_UINT64 tx_failed_cnt;
A_UINT64 tx_retry_cnt;
A_UINT64 tx_mult_retry_cnt;
A_UINT64 tx_rts_fail_cnt;
u64 tx_errors;
u64 tx_failed_cnt;
u64 tx_retry_cnt;
u64 tx_mult_retry_cnt;
u64 tx_rts_fail_cnt;
A_UINT64 rx_packets;
A_UINT64 rx_bytes;
A_UINT64 rx_unicast_pkts;
A_UINT64 rx_unicast_bytes;
A_UINT64 rx_multicast_pkts;
A_UINT64 rx_multicast_bytes;
A_UINT64 rx_broadcast_pkts;
A_UINT64 rx_broadcast_bytes;
A_UINT64 rx_fragment_pkt;
u64 rx_packets;
u64 rx_bytes;
u64 rx_unicast_pkts;
u64 rx_unicast_bytes;
u64 rx_multicast_pkts;
u64 rx_multicast_bytes;
u64 rx_broadcast_pkts;
u64 rx_broadcast_bytes;
u64 rx_fragment_pkt;
A_UINT64 rx_errors;
A_UINT64 rx_crcerr;
A_UINT64 rx_key_cache_miss;
A_UINT64 rx_decrypt_err;
A_UINT64 rx_duplicate_frames;
u64 rx_errors;
u64 rx_crcerr;
u64 rx_key_cache_miss;
u64 rx_decrypt_err;
u64 rx_duplicate_frames;
A_UINT64 tkip_local_mic_failure;
A_UINT64 tkip_counter_measures_invoked;
A_UINT64 tkip_replays;
A_UINT64 tkip_format_errors;
A_UINT64 ccmp_format_errors;
A_UINT64 ccmp_replays;
u64 tkip_local_mic_failure;
u64 tkip_counter_measures_invoked;
u64 tkip_replays;
u64 tkip_format_errors;
u64 ccmp_format_errors;
u64 ccmp_replays;
A_UINT64 power_save_failure_cnt;
u64 power_save_failure_cnt;
A_UINT64 cs_bmiss_cnt;
A_UINT64 cs_lowRssi_cnt;
A_UINT64 cs_connect_cnt;
A_UINT64 cs_disconnect_cnt;
u64 cs_bmiss_cnt;
u64 cs_lowRssi_cnt;
u64 cs_connect_cnt;
u64 cs_disconnect_cnt;
A_INT32 tx_unicast_rate;
A_INT32 rx_unicast_rate;
s32 tx_unicast_rate;
s32 rx_unicast_rate;
A_UINT32 lq_val;
u32 lq_val;
A_UINT32 wow_num_pkts_dropped;
A_UINT16 wow_num_events_discarded;
u32 wow_num_pkts_dropped;
u16 wow_num_events_discarded;
A_INT16 noise_floor_calibation;
A_INT16 cs_rssi;
A_INT16 cs_aveBeacon_rssi;
A_UINT8 cs_aveBeacon_snr;
A_UINT8 cs_lastRoam_msec;
A_UINT8 cs_snr;
s16 noise_floor_calibation;
s16 cs_rssi;
s16 cs_aveBeacon_rssi;
u8 cs_aveBeacon_snr;
u8 cs_lastRoam_msec;
u8 cs_snr;
A_UINT8 wow_num_host_pkt_wakeups;
A_UINT8 wow_num_host_event_wakeups;
u8 wow_num_host_pkt_wakeups;
u8 wow_num_host_event_wakeups;
A_UINT32 arp_received;
A_UINT32 arp_matched;
A_UINT32 arp_replied;
u32 arp_received;
u32 arp_matched;
u32 arp_replied;
}TARGET_STATS;
typedef struct targetStats_cmd_t {
@ -1097,70 +1098,69 @@ typedef struct targetStats_cmd_t {
#define AR6000_XIOCTL_USER_SETKEYS_RSC_CTRL 1
#define AR6000_USER_SETKEYS_RSC_UNCHANGED 0x00000002
typedef struct {
A_UINT32 keyOpCtrl; /* Bit Map of Key Mgmt Ctrl Flags */
} AR6000_USER_SETKEYS_INFO;
struct ar6000_user_setkeys_info {
u32 keyOpCtrl; /* Bit Map of Key Mgmt Ctrl Flags */
}; /* XXX: unused !? */
/* used by AR6000_XIOCTL_GPIO_OUTPUT_SET */
struct ar6000_gpio_output_set_cmd_s {
A_UINT32 set_mask;
A_UINT32 clear_mask;
A_UINT32 enable_mask;
A_UINT32 disable_mask;
u32 set_mask;
u32 clear_mask;
u32 enable_mask;
u32 disable_mask;
};
/*
* used by AR6000_XIOCTL_GPIO_REGISTER_GET and AR6000_XIOCTL_GPIO_REGISTER_SET
*/
struct ar6000_gpio_register_cmd_s {
A_UINT32 gpioreg_id;
A_UINT32 value;
u32 gpioreg_id;
u32 value;
};
/* used by AR6000_XIOCTL_GPIO_INTR_ACK */
struct ar6000_gpio_intr_ack_cmd_s {
A_UINT32 ack_mask;
u32 ack_mask;
};
/* used by AR6000_XIOCTL_GPIO_INTR_WAIT */
struct ar6000_gpio_intr_wait_cmd_s {
A_UINT32 intr_mask;
A_UINT32 input_values;
u32 intr_mask;
u32 input_values;
};
/* used by the AR6000_XIOCTL_DBGLOG_CFG_MODULE */
typedef struct ar6000_dbglog_module_config_s {
A_UINT32 valid;
A_UINT16 mmask;
A_UINT16 tsr;
A_BOOL rep;
A_UINT16 size;
u32 valid;
u16 mmask;
u16 tsr;
u32 rep;
u16 size;
} DBGLOG_MODULE_CONFIG;
typedef struct user_rssi_thold_t {
A_INT16 tag;
A_INT16 rssi;
s16 tag;
s16 rssi;
} USER_RSSI_THOLD;
typedef struct user_rssi_params_t {
A_UINT8 weight;
A_UINT32 pollTime;
u8 weight;
u32 pollTime;
USER_RSSI_THOLD tholds[12];
} USER_RSSI_PARAMS;
typedef struct ar6000_get_btcoex_config_cmd_t{
A_UINT32 btProfileType;
A_UINT32 linkId;
u32 btProfileType;
u32 linkId;
}AR6000_GET_BTCOEX_CONFIG_CMD;
typedef struct ar6000_btcoex_config_t {
AR6000_GET_BTCOEX_CONFIG_CMD configCmd;
A_UINT32 * configEvent;
u32 *configEvent;
} AR6000_BTCOEX_CONFIG;
typedef struct ar6000_btcoex_stats_t {
A_UINT32 * statsEvent;
u32 *statsEvent;
}AR6000_BTCOEX_STATS;
/*
* Host driver may have some config parameters. Typically, these
@ -1183,14 +1183,14 @@ struct ar6000_diag_window_cmd_s {
struct ar6000_traffic_activity_change {
A_UINT32 StreamID; /* stream ID to indicate activity change */
A_UINT32 Active; /* active (1) or inactive (0) */
u32 StreamID; /* stream ID to indicate activity change */
u32 Active; /* active (1) or inactive (0) */
};
/* Used with AR6000_XIOCTL_PROF_COUNT_GET */
struct prof_count_s {
A_UINT32 addr; /* bin start address */
A_UINT32 count; /* hit count */
u32 addr; /* bin start address */
u32 count; /* hit count */
};
@ -1198,8 +1198,8 @@ struct prof_count_s {
/* AR6000_XIOCTL_MODULE_DEBUG_GET_MASK */
/* AR6000_XIOCTL_DUMP_MODULE_DEBUG_INFO */
struct drv_debug_module_s {
A_CHAR modulename[128]; /* name of module */
A_UINT32 mask; /* new mask to set .. or .. current mask */
char modulename[128]; /* name of module */
u32 mask; /* new mask to set .. or .. current mask */
};

View File

@ -44,9 +44,7 @@ typedef u_int16_t A_UINT16;
typedef u_int32_t A_UINT32;
typedef u_int64_t A_UINT64;
typedef int A_BOOL;
typedef char A_CHAR;
typedef unsigned char A_UCHAR;
typedef unsigned long A_ATH_TIMER;

View File

@ -25,21 +25,21 @@
#define _AR6K_CFG80211_H_
struct wireless_dev *ar6k_cfg80211_init(struct device *dev);
void ar6k_cfg80211_deinit(AR_SOFTC_T *ar);
void ar6k_cfg80211_deinit(struct ar6_softc *ar);
void ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status);
void ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status);
void ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel,
A_UINT8 *bssid, A_UINT16 listenInterval,
A_UINT16 beaconInterval,NETWORK_TYPE networkType,
A_UINT8 beaconIeLen, A_UINT8 assocReqLen,
A_UINT8 assocRespLen, A_UINT8 *assocInfo);
void ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel,
u8 *bssid, u16 listenInterval,
u16 beaconInterval,NETWORK_TYPE networkType,
u8 beaconIeLen, u8 assocReqLen,
u8 assocRespLen, u8 *assocInfo);
void ar6k_cfg80211_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason,
A_UINT8 *bssid, A_UINT8 assocRespLen,
A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus);
void ar6k_cfg80211_disconnect_event(struct ar6_softc *ar, u8 reason,
u8 *bssid, u8 assocRespLen,
u8 *assocInfo, u16 protocolReasonStatus);
void ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast);
void ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast);
#endif /* _AR6K_CFG80211_H_ */

View File

@ -25,18 +25,18 @@
#include "hci_transport_api.h"
#include "common_drv.h"
extern HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, HCI_TRANSPORT_CONFIG_INFO *pInfo);
extern HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, struct hci_transport_config_info *pInfo);
extern void (*_HCI_TransportDetach)(HCI_TRANSPORT_HANDLE HciTrans);
extern A_STATUS (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET_QUEUE *pQueue);
extern A_STATUS (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *pPacket, A_BOOL Synchronous);
extern int (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet_queue *pQueue);
extern int (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, struct htc_packet *pPacket, bool Synchronous);
extern void (*_HCI_TransportStop)(HCI_TRANSPORT_HANDLE HciTrans);
extern A_STATUS (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans);
extern A_STATUS (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
extern A_STATUS (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans,
HTC_PACKET *pPacket,
extern int (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans);
extern int (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
extern int (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans,
struct htc_packet *pPacket,
int MaxPollMS);
extern A_STATUS (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, A_UINT32 Baud);
extern A_STATUS (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, A_BOOL Enable);
extern int (*_HCI_TransportSetBaudRate)(HCI_TRANSPORT_HANDLE HciTrans, u32 Baud);
extern int (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTrans, bool Enable);
#define HCI_TransportAttach(HTCHandle, pInfo) \
@ -61,11 +61,11 @@ extern A_STATUS (*_HCI_TransportEnablePowerMgmt)(HCI_TRANSPORT_HANDLE HciTran
_HCI_TransportEnablePowerMgmt((HciTrans), (Enable))
extern A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallbacks);
extern int ar6000_register_hci_transport(struct hci_transport_callbacks *hciTransCallbacks);
extern A_STATUS ar6000_get_hif_dev(HIF_DEVICE *device, void *config);
extern int ar6000_get_hif_dev(struct hif_device *device, void *config);
extern A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice, A_UINT32 scale, A_UINT32 step);
extern int ar6000_set_uart_config(struct hif_device *hifDevice, u32 scale, u32 step);
/* get core clock register settings
* data: 0 - 40/44MHz
@ -73,4 +73,4 @@ extern A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice, A_UINT32 scale, A_
* where (5G band/2.4G band)
* assume 2.4G band for now
*/
extern A_STATUS ar6000_get_core_clock_config(HIF_DEVICE *hifDevice, A_UINT32 *data);
extern int ar6000_get_core_clock_config(struct hif_device *hifDevice, u32 *data);

View File

@ -76,9 +76,7 @@
#define A_CPU2BE16(x) htons(x)
#define A_CPU2BE32(x) htonl(x)
#define A_MEMCPY(dst, src, len) memcpy((A_UINT8 *)(dst), (src), (len))
#define A_MEMZERO(addr, len) memset(addr, 0, len)
#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len))
#define A_MALLOC(size) kmalloc((size), GFP_KERNEL)
#define A_MALLOC_NOWAIT(size) kmalloc((size), GFP_ATOMIC)
#define A_FREE(addr) kfree(addr)
@ -116,12 +114,12 @@ typedef spinlock_t A_MUTEX_T;
#define A_MUTEX_INIT(mutex) spin_lock_init(mutex)
#define A_MUTEX_LOCK(mutex) spin_lock_bh(mutex)
#define A_MUTEX_UNLOCK(mutex) spin_unlock_bh(mutex)
#define A_IS_MUTEX_VALID(mutex) TRUE /* okay to return true, since A_MUTEX_DELETE does nothing */
#define A_IS_MUTEX_VALID(mutex) true /* okay to return true, since A_MUTEX_DELETE does nothing */
#define A_MUTEX_DELETE(mutex) /* spin locks are not kernel resources so nothing to free.. */
/* Get current time in ms adding a constant offset (in ms) */
#define A_GET_MS(offset) \
(jiffies + ((offset) / 1000) * HZ)
(((jiffies / HZ) * 1000) + (offset))
/*
* Timer Functions
@ -247,7 +245,7 @@ typedef struct sk_buff_head A_NETBUF_QUEUE_T;
#define A_NETBUF_QUEUE_SIZE(q) \
a_netbuf_queue_size(q)
#define A_NETBUF_QUEUE_EMPTY(q) \
a_netbuf_queue_empty(q)
(a_netbuf_queue_empty(q) ? true : false)
/*
* Network buffer support
@ -306,17 +304,17 @@ void *a_netbuf_alloc(int size);
void *a_netbuf_alloc_raw(int size);
void a_netbuf_free(void *bufPtr);
void *a_netbuf_to_data(void *bufPtr);
A_UINT32 a_netbuf_to_len(void *bufPtr);
A_STATUS a_netbuf_push(void *bufPtr, A_INT32 len);
A_STATUS a_netbuf_push_data(void *bufPtr, char *srcPtr, A_INT32 len);
A_STATUS a_netbuf_put(void *bufPtr, A_INT32 len);
A_STATUS a_netbuf_put_data(void *bufPtr, char *srcPtr, A_INT32 len);
A_STATUS a_netbuf_pull(void *bufPtr, A_INT32 len);
A_STATUS a_netbuf_pull_data(void *bufPtr, char *dstPtr, A_INT32 len);
A_STATUS a_netbuf_trim(void *bufPtr, A_INT32 len);
A_STATUS a_netbuf_trim_data(void *bufPtr, char *dstPtr, A_INT32 len);
A_STATUS a_netbuf_setlen(void *bufPtr, A_INT32 len);
A_INT32 a_netbuf_headroom(void *bufPtr);
u32 a_netbuf_to_len(void *bufPtr);
int a_netbuf_push(void *bufPtr, s32 len);
int a_netbuf_push_data(void *bufPtr, char *srcPtr, s32 len);
int a_netbuf_put(void *bufPtr, s32 len);
int a_netbuf_put_data(void *bufPtr, char *srcPtr, s32 len);
int a_netbuf_pull(void *bufPtr, s32 len);
int a_netbuf_pull_data(void *bufPtr, char *dstPtr, s32 len);
int a_netbuf_trim(void *bufPtr, s32 len);
int a_netbuf_trim_data(void *bufPtr, char *dstPtr, s32 len);
int a_netbuf_setlen(void *bufPtr, s32 len);
s32 a_netbuf_headroom(void *bufPtr);
void a_netbuf_enqueue(A_NETBUF_QUEUE_T *q, void *pkt);
void a_netbuf_prequeue(A_NETBUF_QUEUE_T *q, void *pkt);
void *a_netbuf_dequeue(A_NETBUF_QUEUE_T *q);
@ -328,8 +326,8 @@ void a_netbuf_queue_init(A_NETBUF_QUEUE_T *q);
/*
* Kernel v.s User space functions
*/
A_UINT32 a_copy_to_user(void *to, const void *from, A_UINT32 n);
A_UINT32 a_copy_from_user(void *to, const void *from, A_UINT32 n);
u32 a_copy_to_user(void *to, const void *from, u32 n);
u32 a_copy_from_user(void *to, const void *from, u32 n);
/* In linux, WLAN Rx and Tx run in different contexts, so no need to check
* for any commands/data queued for WLAN */
@ -364,9 +362,7 @@ static inline void *A_ALIGN_TO_CACHE_LINE(void *ptr) {
#define PREPACK
#define POSTPACK __ATTRIB_PACK
#define A_MEMCPY(dst, src, len) memcpy((dst), (src), (len))
#define A_MEMZERO(addr, len) memset((addr), 0, (len))
#define A_MEMCMP(addr1, addr2, len) memcmp((addr1), (addr2), (len))
#define A_MALLOC(size) malloc(size)
#define A_FREE(addr) free(addr)

View File

@ -102,6 +102,13 @@
*/
#define WLAN_CONFIG_PM_WOW2 0
/*
* This configuration item enables/disables transmit bursting
* 0 - Enable tx Bursting (default)
* 1 - Disable tx bursting
*/
#define WLAN_CONFIG_DISABLE_TX_BURSTING 0
/*
* Platform specific function to power ON/OFF AR6000
* and enable/disable SDIO card detection

View File

@ -41,7 +41,7 @@
* (0xFF) - Allow this cmd always irrespective of mode
*/
A_UINT8 sioctl_filter[] = {
u8 sioctl_filter[] = {
(AP_NETWORK), /* SIOCSIWCOMMIT 0x8B00 */
(0xFF), /* SIOCGIWNAME 0x8B01 */
(0), /* SIOCSIWNWID 0x8B02 */
@ -96,7 +96,7 @@ A_UINT8 sioctl_filter[] = {
A_UINT8 pioctl_filter[] = {
u8 pioctl_filter[] = {
(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_SETPARAM (SIOCIWFIRSTPRIV+0) */
(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_SETKEY (SIOCIWFIRSTPRIV+1) */
(INFRA_NETWORK | ADHOC_NETWORK | AP_NETWORK), /* IEEE80211_IOCTL_DELKEY (SIOCIWFIRSTPRIV+2) */
@ -132,7 +132,7 @@ A_UINT8 pioctl_filter[] = {
A_UINT8 xioctl_filter[] = {
u8 xioctl_filter[] = {
(0xFF), /* Dummy 0 */
(0xFF), /* AR6000_XIOCTL_BMI_DONE 1 */
(0xFF), /* AR6000_XIOCTL_BMI_READ_MEMORY 2 */
@ -288,6 +288,13 @@ A_UINT8 xioctl_filter[] = {
(0xFF), /* AR6000_XIOCTL_ADD_AP_INTERFACE 152 */
(0xFF), /* AR6000_XIOCTL_REMOVE_AP_INTERFACE 153 */
(0xFF), /* AR6000_XIOCTL_WMI_SET_TX_SGI_PARAM 154 */
(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_WPA_OFFLOAD_STATE 155 */
(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_PASSPHRASE 156 */
(0xFF),
(0xFF),
(0xFF),
(0xFF),
(INFRA_NETWORK | ADHOC_NETWORK), /* AR6000_XIOCTL_WMI_SET_EXCESS_TX_RETRY_THRES 161 */
};
#endif /*_WMI_FILTER_LINUX_H_*/

File diff suppressed because it is too large Load Diff

View File

@ -63,8 +63,8 @@ a_netbuf_alloc(int size)
{
struct sk_buff *skb;
size += 2 * (A_GET_CACHE_LINE_BYTES()); /* add some cacheline space at front and back of buffer */
skb = dev_alloc_skb(AR6000_DATA_OFFSET + sizeof(HTC_PACKET) + size);
skb_reserve(skb, AR6000_DATA_OFFSET + sizeof(HTC_PACKET) + A_GET_CACHE_LINE_BYTES());
skb = dev_alloc_skb(AR6000_DATA_OFFSET + sizeof(struct htc_packet) + size);
skb_reserve(skb, AR6000_DATA_OFFSET + sizeof(struct htc_packet) + A_GET_CACHE_LINE_BYTES());
return ((void *)skb);
}
@ -89,8 +89,7 @@ a_netbuf_free(void *bufPtr)
dev_kfree_skb(skb);
}
A_UINT32
a_netbuf_to_len(void *bufPtr)
u32 a_netbuf_to_len(void *bufPtr)
{
return (((struct sk_buff *)bufPtr)->len);
}
@ -105,98 +104,97 @@ a_netbuf_to_data(void *bufPtr)
* Add len # of bytes to the beginning of the network buffer
* pointed to by bufPtr
*/
A_STATUS
a_netbuf_push(void *bufPtr, A_INT32 len)
int
a_netbuf_push(void *bufPtr, s32 len)
{
skb_push((struct sk_buff *)bufPtr, len);
return A_OK;
return 0;
}
/*
* Add len # of bytes to the beginning of the network buffer
* pointed to by bufPtr and also fill with data
*/
A_STATUS
a_netbuf_push_data(void *bufPtr, char *srcPtr, A_INT32 len)
int
a_netbuf_push_data(void *bufPtr, char *srcPtr, s32 len)
{
skb_push((struct sk_buff *) bufPtr, len);
A_MEMCPY(((struct sk_buff *)bufPtr)->data, srcPtr, len);
memcpy(((struct sk_buff *)bufPtr)->data, srcPtr, len);
return A_OK;
return 0;
}
/*
* Add len # of bytes to the end of the network buffer
* pointed to by bufPtr
*/
A_STATUS
a_netbuf_put(void *bufPtr, A_INT32 len)
int
a_netbuf_put(void *bufPtr, s32 len)
{
skb_put((struct sk_buff *)bufPtr, len);
return A_OK;
return 0;
}
/*
* Add len # of bytes to the end of the network buffer
* pointed to by bufPtr and also fill with data
*/
A_STATUS
a_netbuf_put_data(void *bufPtr, char *srcPtr, A_INT32 len)
int
a_netbuf_put_data(void *bufPtr, char *srcPtr, s32 len)
{
char *start = (char*)(((struct sk_buff *)bufPtr)->data +
((struct sk_buff *)bufPtr)->len);
skb_put((struct sk_buff *)bufPtr, len);
A_MEMCPY(start, srcPtr, len);
memcpy(start, srcPtr, len);
return A_OK;
return 0;
}
/*
* Trim the network buffer pointed to by bufPtr to len # of bytes
*/
A_STATUS
a_netbuf_setlen(void *bufPtr, A_INT32 len)
int
a_netbuf_setlen(void *bufPtr, s32 len)
{
skb_trim((struct sk_buff *)bufPtr, len);
return A_OK;
return 0;
}
/*
* Chop of len # of bytes from the end of the buffer.
*/
A_STATUS
a_netbuf_trim(void *bufPtr, A_INT32 len)
int
a_netbuf_trim(void *bufPtr, s32 len)
{
skb_trim((struct sk_buff *)bufPtr, ((struct sk_buff *)bufPtr)->len - len);
return A_OK;
return 0;
}
/*
* Chop of len # of bytes from the end of the buffer and return the data.
*/
A_STATUS
a_netbuf_trim_data(void *bufPtr, char *dstPtr, A_INT32 len)
int
a_netbuf_trim_data(void *bufPtr, char *dstPtr, s32 len)
{
char *start = (char*)(((struct sk_buff *)bufPtr)->data +
(((struct sk_buff *)bufPtr)->len - len));
A_MEMCPY(dstPtr, start, len);
memcpy(dstPtr, start, len);
skb_trim((struct sk_buff *)bufPtr, ((struct sk_buff *)bufPtr)->len - len);
return A_OK;
return 0;
}
/*
* Returns the number of bytes available to a a_netbuf_push()
*/
A_INT32
a_netbuf_headroom(void *bufPtr)
s32 a_netbuf_headroom(void *bufPtr)
{
return (skb_headroom((struct sk_buff *)bufPtr));
}
@ -204,25 +202,25 @@ a_netbuf_headroom(void *bufPtr)
/*
* Removes specified number of bytes from the beginning of the buffer
*/
A_STATUS
a_netbuf_pull(void *bufPtr, A_INT32 len)
int
a_netbuf_pull(void *bufPtr, s32 len)
{
skb_pull((struct sk_buff *)bufPtr, len);
return A_OK;
return 0;
}
/*
* Removes specified number of bytes from the beginning of the buffer
* and return the data
*/
A_STATUS
a_netbuf_pull_data(void *bufPtr, char *dstPtr, A_INT32 len)
int
a_netbuf_pull_data(void *bufPtr, char *dstPtr, s32 len)
{
A_MEMCPY(dstPtr, ((struct sk_buff *)bufPtr)->data, len);
memcpy(dstPtr, ((struct sk_buff *)bufPtr)->data, len);
skb_pull((struct sk_buff *)bufPtr, len);
return A_OK;
return 0;
}
#ifdef EXPORT_HCI_BRIDGE_INTERFACE

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@
#define AGGR_GET_RXTID(_p, _x) (&(_p->RxTid[(_x)]))
/* Hold q is a function of win_sz, which is negotiated per tid */
#define HOLD_Q_SZ(_x) (TID_WINDOW_SZ((_x))*sizeof(OSBUF_HOLD_Q))
#define HOLD_Q_SZ(_x) (TID_WINDOW_SZ((_x))*sizeof(struct osbuf_hold_q))
/* AGGR_RX_TIMEOUT value is important as a (too) small value can cause frames to be
* delivered out of order and a (too) large value can cause undesirable latency in
* certain situations. */
@ -59,58 +59,59 @@ typedef enum {
CONTIGUOUS_SEQNO = 1,
}DELIVERY_ORDER;
typedef struct {
struct osbuf_hold_q {
void *osbuf;
A_BOOL is_amsdu;
A_UINT16 seq_no;
}OSBUF_HOLD_Q;
bool is_amsdu;
u16 seq_no;
};
#if 0
typedef struct {
A_UINT16 seqno_st;
A_UINT16 seqno_end;
}WINDOW_SNAPSHOT;
/* XXX: unused ? */
struct window_snapshot {
u16 seqno_st;
u16 seqno_end;
};
#endif
typedef struct {
A_BOOL aggr; /* is it ON or OFF */
A_BOOL progress; /* TRUE when frames have arrived after a timer start */
A_BOOL timerMon; /* TRUE if the timer started for the sake of this TID */
A_UINT16 win_sz; /* negotiated window size */
A_UINT16 seq_next; /* Next seq no, in current window */
A_UINT32 hold_q_sz; /* Num of frames that can be held in hold q */
OSBUF_HOLD_Q *hold_q; /* Hold q for re-order */
struct rxtid {
bool aggr; /* is it ON or OFF */
bool progress; /* true when frames have arrived after a timer start */
bool timerMon; /* true if the timer started for the sake of this TID */
u16 win_sz; /* negotiated window size */
u16 seq_next; /* Next seq no, in current window */
u32 hold_q_sz; /* Num of frames that can be held in hold q */
struct osbuf_hold_q *hold_q; /* Hold q for re-order */
#if 0
WINDOW_SNAPSHOT old_win; /* Sliding window snapshot - for timeout */
struct window_snapshot old_win; /* Sliding window snapshot - for timeout */
#endif
A_NETBUF_QUEUE_T q; /* q head for enqueuing frames for dispatch */
A_MUTEX_T lock;
}RXTID;
};
typedef struct {
A_UINT32 num_into_aggr; /* hitting at the input of this module */
A_UINT32 num_dups; /* duplicate */
A_UINT32 num_oow; /* out of window */
A_UINT32 num_mpdu; /* single payload 802.3/802.11 frame */
A_UINT32 num_amsdu; /* AMSDU */
A_UINT32 num_delivered; /* frames delivered to IP stack */
A_UINT32 num_timeouts; /* num of timeouts, during which frames delivered */
A_UINT32 num_hole; /* frame not present, when window moved over */
A_UINT32 num_bar; /* num of resets of seq_num, via BAR */
}RXTID_STATS;
struct rxtid_stats {
u32 num_into_aggr; /* hitting at the input of this module */
u32 num_dups; /* duplicate */
u32 num_oow; /* out of window */
u32 num_mpdu; /* single payload 802.3/802.11 frame */
u32 num_amsdu; /* AMSDU */
u32 num_delivered; /* frames delivered to IP stack */
u32 num_timeouts; /* num of timeouts, during which frames delivered */
u32 num_hole; /* frame not present, when window moved over */
u32 num_bar; /* num of resets of seq_num, via BAR */
};
typedef struct {
A_UINT8 aggr_sz; /* config value of aggregation size */
A_UINT8 timerScheduled;
struct aggr_info {
u8 aggr_sz; /* config value of aggregation size */
u8 timerScheduled;
A_TIMER timer; /* timer for returning held up pkts in re-order que */
void *dev; /* dev handle */
RX_CALLBACK rx_fn; /* callback function to return frames; to upper layer */
RXTID RxTid[NUM_OF_TIDS]; /* Per tid window */
struct rxtid RxTid[NUM_OF_TIDS]; /* Per tid window */
ALLOC_NETBUFS netbuf_allocator; /* OS netbuf alloc fn */
A_NETBUF_QUEUE_T freeQ; /* pre-allocated buffers - for A_MSDU slicing */
RXTID_STATS stat[NUM_OF_TIDS]; /* Tid based statistics */
struct rxtid_stats stat[NUM_OF_TIDS]; /* Tid based statistics */
PACKET_LOG pkt_log; /* Log info of the packets */
}AGGR_INFO;
};
#endif /* __AGGR_RX_INTERNAL_H__ */

View File

@ -33,36 +33,36 @@
#include "aggr_rx_internal.h"
#include "wmi.h"
extern A_STATUS
extern int
wmi_dot3_2_dix(void *osbuf);
static void
aggr_slice_amsdu(AGGR_INFO *p_aggr, RXTID *rxtid, void **osbuf);
aggr_slice_amsdu(struct aggr_info *p_aggr, struct rxtid *rxtid, void **osbuf);
static void
aggr_timeout(A_ATH_TIMER arg);
static void
aggr_deque_frms(AGGR_INFO *p_aggr, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 order);
aggr_deque_frms(struct aggr_info *p_aggr, u8 tid, u16 seq_no, u8 order);
static void
aggr_dispatch_frames(AGGR_INFO *p_aggr, A_NETBUF_QUEUE_T *q);
aggr_dispatch_frames(struct aggr_info *p_aggr, A_NETBUF_QUEUE_T *q);
static void *
aggr_get_osbuf(AGGR_INFO *p_aggr);
aggr_get_osbuf(struct aggr_info *p_aggr);
void *
aggr_init(ALLOC_NETBUFS netbuf_allocator)
{
AGGR_INFO *p_aggr = NULL;
RXTID *rxtid;
A_UINT8 i;
A_STATUS status = A_OK;
struct aggr_info *p_aggr = NULL;
struct rxtid *rxtid;
u8 i;
int status = 0;
A_PRINTF("In aggr_init..\n");
do {
p_aggr = A_MALLOC(sizeof(AGGR_INFO));
p_aggr = A_MALLOC(sizeof(struct aggr_info));
if(!p_aggr) {
A_PRINTF("Failed to allocate memory for aggr_node\n");
status = A_ERROR;
@ -70,10 +70,10 @@ aggr_init(ALLOC_NETBUFS netbuf_allocator)
}
/* Init timer and data structures */
A_MEMZERO(p_aggr, sizeof(AGGR_INFO));
A_MEMZERO(p_aggr, sizeof(struct aggr_info));
p_aggr->aggr_sz = AGGR_SZ_DEFAULT;
A_INIT_TIMER(&p_aggr->timer, aggr_timeout, p_aggr);
p_aggr->timerScheduled = FALSE;
p_aggr->timerScheduled = false;
A_NETBUF_QUEUE_INIT(&p_aggr->freeQ);
p_aggr->netbuf_allocator = netbuf_allocator;
@ -81,30 +81,30 @@ aggr_init(ALLOC_NETBUFS netbuf_allocator)
for(i = 0; i < NUM_OF_TIDS; i++) {
rxtid = AGGR_GET_RXTID(p_aggr, i);
rxtid->aggr = FALSE;
rxtid->progress = FALSE;
rxtid->timerMon = FALSE;
rxtid->aggr = false;
rxtid->progress = false;
rxtid->timerMon = false;
A_NETBUF_QUEUE_INIT(&rxtid->q);
A_MUTEX_INIT(&rxtid->lock);
}
}while(FALSE);
}while(false);
A_PRINTF("going out of aggr_init..status %s\n",
(status == A_OK) ? "OK":"Error");
(status == 0) ? "OK":"Error");
if(status != A_OK) {
if (status) {
/* Cleanup */
aggr_module_destroy(p_aggr);
}
return ((status == A_OK) ? p_aggr : NULL);
return ((status == 0) ? p_aggr : NULL);
}
/* utility function to clear rx hold_q for a tid */
static void
aggr_delete_tid_state(AGGR_INFO *p_aggr, A_UINT8 tid)
aggr_delete_tid_state(struct aggr_info *p_aggr, u8 tid)
{
RXTID *rxtid;
RXTID_STATS *stats;
struct rxtid *rxtid;
struct rxtid_stats *stats;
A_ASSERT(tid < NUM_OF_TIDS && p_aggr);
@ -115,9 +115,9 @@ aggr_delete_tid_state(AGGR_INFO *p_aggr, A_UINT8 tid)
aggr_deque_frms(p_aggr, tid, 0, ALL_SEQNO);
}
rxtid->aggr = FALSE;
rxtid->progress = FALSE;
rxtid->timerMon = FALSE;
rxtid->aggr = false;
rxtid->progress = false;
rxtid->timerMon = false;
rxtid->win_sz = 0;
rxtid->seq_next = 0;
rxtid->hold_q_sz = 0;
@ -127,22 +127,22 @@ aggr_delete_tid_state(AGGR_INFO *p_aggr, A_UINT8 tid)
rxtid->hold_q = NULL;
}
A_MEMZERO(stats, sizeof(RXTID_STATS));
A_MEMZERO(stats, sizeof(struct rxtid_stats));
}
void
aggr_module_destroy(void *cntxt)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID *rxtid;
A_UINT8 i, k;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid *rxtid;
u8 i, k;
A_PRINTF("%s(): aggr = %p\n",_A_FUNCNAME_, p_aggr);
A_ASSERT(p_aggr);
if(p_aggr) {
if(p_aggr->timerScheduled) {
A_UNTIMEOUT(&p_aggr->timer);
p_aggr->timerScheduled = FALSE;
p_aggr->timerScheduled = false;
}
for(i = 0; i < NUM_OF_TIDS; i++) {
@ -177,7 +177,7 @@ aggr_module_destroy(void *cntxt)
void
aggr_register_rx_dispatcher(void *cntxt, void * dev, RX_CALLBACK fn)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
A_ASSERT(p_aggr && fn && dev);
@ -187,10 +187,10 @@ aggr_register_rx_dispatcher(void *cntxt, void * dev, RX_CALLBACK fn)
void
aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no)
aggr_process_bar(void *cntxt, u8 tid, u16 seq_no)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID_STATS *stats;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid_stats *stats;
A_ASSERT(p_aggr);
stats = AGGR_GET_RXTID_STATS(p_aggr, tid);
@ -201,11 +201,11 @@ aggr_process_bar(void *cntxt, A_UINT8 tid, A_UINT16 seq_no)
void
aggr_recv_addba_req_evt(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_sz)
aggr_recv_addba_req_evt(void *cntxt, u8 tid, u16 seq_no, u8 win_sz)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID *rxtid;
RXTID_STATS *stats;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid *rxtid;
struct rxtid_stats *stats;
A_ASSERT(p_aggr);
rxtid = AGGR_GET_RXTID(p_aggr, tid);
@ -249,14 +249,14 @@ aggr_recv_addba_req_evt(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 win_s
A_ASSERT(0);
}
rxtid->aggr = TRUE;
rxtid->aggr = true;
}
void
aggr_recv_delba_req_evt(void *cntxt, A_UINT8 tid)
aggr_recv_delba_req_evt(void *cntxt, u8 tid)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID *rxtid;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid *rxtid;
A_ASSERT(p_aggr);
A_PRINTF("%s(): tid %d\n", _A_FUNCNAME_, tid);
@ -269,12 +269,12 @@ aggr_recv_delba_req_evt(void *cntxt, A_UINT8 tid)
}
static void
aggr_deque_frms(AGGR_INFO *p_aggr, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 order)
aggr_deque_frms(struct aggr_info *p_aggr, u8 tid, u16 seq_no, u8 order)
{
RXTID *rxtid;
OSBUF_HOLD_Q *node;
A_UINT16 idx, idx_end, seq_end;
RXTID_STATS *stats;
struct rxtid *rxtid;
struct osbuf_hold_q *node;
u16 idx, idx_end, seq_end;
struct rxtid_stats *stats;
A_ASSERT(p_aggr);
rxtid = AGGR_GET_RXTID(p_aggr, tid);
@ -334,7 +334,7 @@ aggr_deque_frms(AGGR_INFO *p_aggr, A_UINT8 tid, A_UINT16 seq_no, A_UINT8 order)
}
static void *
aggr_get_osbuf(AGGR_INFO *p_aggr)
aggr_get_osbuf(struct aggr_info *p_aggr)
{
void *buf = NULL;
@ -356,11 +356,11 @@ aggr_get_osbuf(AGGR_INFO *p_aggr)
static void
aggr_slice_amsdu(AGGR_INFO *p_aggr, RXTID *rxtid, void **osbuf)
aggr_slice_amsdu(struct aggr_info *p_aggr, struct rxtid *rxtid, void **osbuf)
{
void *new_buf;
A_UINT16 frame_8023_len, payload_8023_len, mac_hdr_len, amsdu_len;
A_UINT8 *framep;
u16 frame_8023_len, payload_8023_len, mac_hdr_len, amsdu_len;
u8 *framep;
/* Frame format at this point:
* [DIX hdr | 802.3 | 802.3 | ... | 802.3]
@ -397,9 +397,9 @@ aggr_slice_amsdu(AGGR_INFO *p_aggr, RXTID *rxtid, void **osbuf)
break;
}
A_MEMCPY(A_NETBUF_DATA(new_buf), framep, frame_8023_len);
memcpy(A_NETBUF_DATA(new_buf), framep, frame_8023_len);
A_NETBUF_PUT(new_buf, frame_8023_len);
if (wmi_dot3_2_dix(new_buf) != A_OK) {
if (wmi_dot3_2_dix(new_buf) != 0) {
A_PRINTF("dot3_2_dix err..\n");
A_NETBUF_FREE(new_buf);
break;
@ -426,14 +426,14 @@ aggr_slice_amsdu(AGGR_INFO *p_aggr, RXTID *rxtid, void **osbuf)
}
void
aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu, void **osbuf)
aggr_process_recv_frm(void *cntxt, u8 tid, u16 seq_no, bool is_amsdu, void **osbuf)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID *rxtid;
RXTID_STATS *stats;
A_UINT16 idx, st, cur, end;
A_UINT16 *log_idx;
OSBUF_HOLD_Q *node;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid *rxtid;
struct rxtid_stats *stats;
u16 idx, st, cur, end;
u16 *log_idx;
struct osbuf_hold_q *node;
PACKET_LOG *log;
A_ASSERT(p_aggr);
@ -472,7 +472,7 @@ aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu
* be assumed that the window has moved for some valid reason.
* Therefore, we dequeue all frames and start fresh.
*/
A_UINT16 extended_end;
u16 extended_end;
extended_end = (end + rxtid->hold_q_sz-1) & IEEE80211_MAX_SEQ_NO;
@ -536,17 +536,17 @@ aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu
aggr_deque_frms(p_aggr, tid, 0, CONTIGUOUS_SEQNO);
if(p_aggr->timerScheduled) {
rxtid->progress = TRUE;
rxtid->progress = true;
}else{
for(idx=0 ; idx<rxtid->hold_q_sz ; idx++) {
if(rxtid->hold_q[idx].osbuf) {
/* there is a frame in the queue and no timer so
* start a timer to ensure that the frame doesn't remain
* stuck forever. */
p_aggr->timerScheduled = TRUE;
p_aggr->timerScheduled = true;
A_TIMEOUT_MS(&p_aggr->timer, AGGR_RX_TIMEOUT, 0);
rxtid->progress = FALSE;
rxtid->timerMon = TRUE;
rxtid->progress = false;
rxtid->timerMon = true;
break;
}
}
@ -561,8 +561,8 @@ aggr_process_recv_frm(void *cntxt, A_UINT8 tid, A_UINT16 seq_no, A_BOOL is_amsdu
void
aggr_reset_state(void *cntxt)
{
A_UINT8 tid;
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
u8 tid;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
A_ASSERT(p_aggr);
@ -575,10 +575,10 @@ aggr_reset_state(void *cntxt)
static void
aggr_timeout(A_ATH_TIMER arg)
{
A_UINT8 i,j;
AGGR_INFO *p_aggr = (AGGR_INFO *)arg;
RXTID *rxtid;
RXTID_STATS *stats;
u8 i,j;
struct aggr_info *p_aggr = (struct aggr_info *)arg;
struct rxtid *rxtid;
struct rxtid_stats *stats;
/*
* If the q for which the timer was originally started has
* not progressed then it is necessary to dequeue all the
@ -588,9 +588,9 @@ aggr_timeout(A_ATH_TIMER arg)
rxtid = AGGR_GET_RXTID(p_aggr, i);
stats = AGGR_GET_RXTID_STATS(p_aggr, i);
if(rxtid->aggr == FALSE ||
rxtid->timerMon == FALSE ||
rxtid->progress == TRUE) {
if(rxtid->aggr == false ||
rxtid->timerMon == false ||
rxtid->progress == true) {
continue;
}
// dequeue all frames in for this tid
@ -599,25 +599,25 @@ aggr_timeout(A_ATH_TIMER arg)
aggr_deque_frms(p_aggr, i, 0, ALL_SEQNO);
}
p_aggr->timerScheduled = FALSE;
p_aggr->timerScheduled = false;
// determine whether a new timer should be started.
for(i = 0; i < NUM_OF_TIDS; i++) {
rxtid = AGGR_GET_RXTID(p_aggr, i);
if(rxtid->aggr == TRUE && rxtid->hold_q) {
if(rxtid->aggr == true && rxtid->hold_q) {
for(j = 0 ; j < rxtid->hold_q_sz ; j++)
{
if(rxtid->hold_q[j].osbuf)
{
p_aggr->timerScheduled = TRUE;
rxtid->timerMon = TRUE;
rxtid->progress = FALSE;
p_aggr->timerScheduled = true;
rxtid->timerMon = true;
rxtid->progress = false;
break;
}
}
if(j >= rxtid->hold_q_sz) {
rxtid->timerMon = FALSE;
rxtid->timerMon = false;
}
}
}
@ -630,7 +630,7 @@ aggr_timeout(A_ATH_TIMER arg)
}
static void
aggr_dispatch_frames(AGGR_INFO *p_aggr, A_NETBUF_QUEUE_T *q)
aggr_dispatch_frames(struct aggr_info *p_aggr, A_NETBUF_QUEUE_T *q)
{
void *osbuf;
@ -642,10 +642,10 @@ aggr_dispatch_frames(AGGR_INFO *p_aggr, A_NETBUF_QUEUE_T *q)
void
aggr_dump_stats(void *cntxt, PACKET_LOG **log_buf)
{
AGGR_INFO *p_aggr = (AGGR_INFO *)cntxt;
RXTID *rxtid;
RXTID_STATS *stats;
A_UINT8 i;
struct aggr_info *p_aggr = (struct aggr_info *)cntxt;
struct rxtid *rxtid;
struct rxtid_stats *stats;
u8 i;
*log_buf = &p_aggr->pkt_log;
A_PRINTF("\n\n================================================\n");

View File

@ -68,9 +68,9 @@
#define IEEE80211_ADDR_EQ(addr1, addr2) \
(A_MEMCMP(addr1, addr2, IEEE80211_ADDR_LEN) == 0)
(memcmp(addr1, addr2, IEEE80211_ADDR_LEN) == 0)
#define IEEE80211_ADDR_COPY(dst,src) A_MEMCPY(dst,src,IEEE80211_ADDR_LEN)
#define IEEE80211_ADDR_COPY(dst,src) memcpy(dst,src,IEEE80211_ADDR_LEN)
#define IEEE80211_KEYBUF_SIZE 16
#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx and rx */
@ -99,24 +99,24 @@
* generic definitions for IEEE 802.11 frames
*/
PREPACK struct ieee80211_frame {
A_UINT8 i_fc[2];
A_UINT8 i_dur[2];
A_UINT8 i_addr1[IEEE80211_ADDR_LEN];
A_UINT8 i_addr2[IEEE80211_ADDR_LEN];
A_UINT8 i_addr3[IEEE80211_ADDR_LEN];
A_UINT8 i_seq[2];
u8 i_fc[2];
u8 i_dur[2];
u8 i_addr1[IEEE80211_ADDR_LEN];
u8 i_addr2[IEEE80211_ADDR_LEN];
u8 i_addr3[IEEE80211_ADDR_LEN];
u8 i_seq[2];
/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
/* see below */
} POSTPACK;
PREPACK struct ieee80211_qosframe {
A_UINT8 i_fc[2];
A_UINT8 i_dur[2];
A_UINT8 i_addr1[IEEE80211_ADDR_LEN];
A_UINT8 i_addr2[IEEE80211_ADDR_LEN];
A_UINT8 i_addr3[IEEE80211_ADDR_LEN];
A_UINT8 i_seq[2];
A_UINT8 i_qos[2];
u8 i_fc[2];
u8 i_dur[2];
u8 i_addr1[IEEE80211_ADDR_LEN];
u8 i_addr2[IEEE80211_ADDR_LEN];
u8 i_addr3[IEEE80211_ADDR_LEN];
u8 i_seq[2];
u8 i_qos[2];
} POSTPACK;
#define IEEE80211_FC0_VERSION_MASK 0x03
@ -320,29 +320,29 @@ typedef enum {
* WMM/802.11e Tspec Element
*/
typedef PREPACK struct wmm_tspec_ie_t {
A_UINT8 elementId;
A_UINT8 len;
A_UINT8 oui[3];
A_UINT8 ouiType;
A_UINT8 ouiSubType;
A_UINT8 version;
A_UINT16 tsInfo_info;
A_UINT8 tsInfo_reserved;
A_UINT16 nominalMSDU;
A_UINT16 maxMSDU;
A_UINT32 minServiceInt;
A_UINT32 maxServiceInt;
A_UINT32 inactivityInt;
A_UINT32 suspensionInt;
A_UINT32 serviceStartTime;
A_UINT32 minDataRate;
A_UINT32 meanDataRate;
A_UINT32 peakDataRate;
A_UINT32 maxBurstSize;
A_UINT32 delayBound;
A_UINT32 minPhyRate;
A_UINT16 sba;
A_UINT16 mediumTime;
u8 elementId;
u8 len;
u8 oui[3];
u8 ouiType;
u8 ouiSubType;
u8 version;
u16 tsInfo_info;
u8 tsInfo_reserved;
u16 nominalMSDU;
u16 maxMSDU;
u32 minServiceInt;
u32 maxServiceInt;
u32 inactivityInt;
u32 suspensionInt;
u32 serviceStartTime;
u32 minDataRate;
u32 meanDataRate;
u32 peakDataRate;
u32 maxBurstSize;
u32 delayBound;
u32 minPhyRate;
u16 sba;
u16 mediumTime;
} POSTPACK WMM_TSPEC_IE;

View File

@ -55,7 +55,7 @@
#define IEEE80211_NODE_HASHSIZE 32
/* simple hash is enough for variation of macaddr */
#define IEEE80211_NODE_HASH(addr) \
(((const A_UINT8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \
(((const u8 *)(addr))[IEEE80211_ADDR_LEN - 1] % \
IEEE80211_NODE_HASHSIZE)
/*
@ -71,14 +71,14 @@ struct ieee80211_node_table {
struct bss *nt_node_last; /* information of all nodes */
struct bss *nt_hash[IEEE80211_NODE_HASHSIZE];
const char *nt_name; /* for debugging */
A_UINT32 nt_scangen; /* gen# for timeout scan */
u32 nt_scangen; /* gen# for timeout scan */
#ifdef THREAD_X
A_TIMER nt_inact_timer;
A_UINT8 isTimerArmed; /* is the node timer armed */
u8 isTimerArmed; /* is the node timer armed */
#endif
A_UINT32 nt_nodeAge; /* node aging time */
u32 nt_nodeAge; /* node aging time */
#ifdef OS_ROAM_MANAGEMENT
A_UINT32 nt_si_gen; /* gen# for scan indication*/
u32 nt_si_gen; /* gen# for scan indication*/
#endif
};

Some files were not shown because too many files have changed in this diff Show More